diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2018-12-29 17:42:22 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-01-04 12:44:50 -0800 |
commit | 1492623e837fe7ca6296f7f5411328307e242771 (patch) | |
tree | 51c3ba3808a22fb2b16cc71816027e22ab493435 /drivers/net/ethernet/marvell/octeontx2/af/cgx.c | |
parent | 96d4f267e40f9509e8a66e2b39e8b95655617693 (diff) | |
download | linux-1492623e837fe7ca6296f7f5411328307e242771.tar.gz linux-1492623e837fe7ca6296f7f5411328307e242771.tar.bz2 linux-1492623e837fe7ca6296f7f5411328307e242771.zip |
octeontx2-af: Fix a resource leak in an error handling path in 'cgx_probe()'
If an error occurs after the call to 'pci_alloc_irq_vectors()', we must
call 'pci_free_irq_vectors()' in order to avoid a resource leak.
The same sequence is already in place in the corresponding 'cgx_remove()'
function.
Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell/octeontx2/af/cgx.c')
-rw-r--r-- | drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c index 742f0c1f60df..6d55e3d0b7ea 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c @@ -825,7 +825,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!cgx->cgx_cmd_workq) { dev_err(dev, "alloc workqueue failed for cgx cmd"); err = -ENOMEM; - goto err_release_regions; + goto err_free_irq_vectors; } list_add(&cgx->cgx_list, &cgx_list); @@ -841,6 +841,8 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_release_lmac: cgx_lmac_exit(cgx); list_del(&cgx->cgx_list); +err_free_irq_vectors: + pci_free_irq_vectors(pdev); err_release_regions: pci_release_regions(pdev); err_disable_device: |