tg3: Fix irq alloc error cleanup path
authorMatt Carlson <mcarlson@broadcom.com>
Fri, 4 Nov 2011 09:15:01 +0000 (09:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Nov 2011 21:31:47 +0000 (17:31 -0400)
This patch fixes a bug where the irq error cleanup path did not free all
the resources it allocated.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Ben Li <benli@broadcom.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/tg3.c

index 3a7517910eedb72bffabb2e0d319e626bd23ad94..0413e1e85641159f822b2a6f74700c87b04a3278 100644 (file)
@@ -9677,15 +9677,14 @@ static int tg3_open(struct net_device *dev)
                struct tg3_napi *tnapi = &tp->napi[i];
                err = tg3_request_irq(tp, i);
                if (err) {
-                       for (i--; i >= 0; i--)
+                       for (i--; i >= 0; i--) {
+                               tnapi = &tp->napi[i];
                                free_irq(tnapi->irq_vec, tnapi);
-                       break;
+                       }
+                       goto err_out2;
                }
        }
 
-       if (err)
-               goto err_out2;
-
        tg3_full_lock(tp, 0);
 
        err = tg3_init_hw(tp, 1);