OSDN Git Service

cnic: Fix an error handling path in 'cnic_alloc_bnx2x_resc()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 21 Sep 2017 23:01:11 +0000 (01:01 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 24 Sep 2017 00:04:27 +0000 (17:04 -0700)
All the error handling paths 'goto error', except this one.
We should also go to error in this case, or some resources will be
leaking.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/cnic.c

index cec94bb..8bc126a 100644 (file)
@@ -1278,7 +1278,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
 
        ret = cnic_alloc_dma(dev, kwq_16_dma, pages, 0);
        if (ret)
-               return -ENOMEM;
+               goto error;
 
        n = CNIC_PAGE_SIZE / CNIC_KWQ16_DATA_SIZE;
        for (i = 0, j = 0; i < cp->max_cid_space; i++) {