summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/qlogic/qlcnic
diff options
context:
space:
mode:
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>2017-02-19 10:35:05 +0100
committerDavid S. Miller <davem@davemloft.net>2017-02-20 10:33:38 -0500
commit766a957df9f51479cb5c7212d19b282da5ca6f07 (patch)
tree9d558ebc18274569a7d02971dc5b8fbbcaeb558e /drivers/net/ethernet/qlogic/qlcnic
parent177c8d1c96eb9851210313922a12ae8b0b63d8c0 (diff)
qlcnic: Fix a memory leak in error handling path
If 'dma_alloc_coherent()' fails, we should release resources allocated so far, just as done in all other cases in this function. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic/qlcnic')
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index daf05155b732..d344e9d43832 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -573,8 +573,10 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter)
ptr = (__le32 *)dma_alloc_coherent(&pdev->dev, sizeof(u32),
&tx_ring->hw_cons_phys_addr,
GFP_KERNEL);
- if (ptr == NULL)
- return -ENOMEM;
+ if (ptr == NULL) {
+ err = -ENOMEM;
+ goto err_out_free;
+ }
tx_ring->hw_consumer = ptr;
/* cmd desc ring */