Commit d101463499b769d04e37d3bcb0e0c6876780ce08

Authored by Yitchak Gertner
Committed by David S. Miller
1 parent 3cdf1db7db

bnx2x: NIC load failure cleanup

Load failures were not handled correctly

Signed-off-by: Yitchak Gertner <gertner@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 10 additions and 12 deletions Side-by-side Diff

drivers/net/bnx2x_main.c
... ... @@ -6341,7 +6341,7 @@
6341 6341 rc = bnx2x_init_hw(bp, load_code);
6342 6342 if (rc) {
6343 6343 BNX2X_ERR("HW init failed, aborting\n");
6344   - goto load_error;
  6344 + goto load_int_disable;
6345 6345 }
6346 6346  
6347 6347 /* Setup NIC internals and enable interrupts */
... ... @@ -6353,7 +6353,7 @@
6353 6353 if (!load_code) {
6354 6354 BNX2X_ERR("MCP response failure, aborting\n");
6355 6355 rc = -EBUSY;
6356   - goto load_int_disable;
  6356 + goto load_rings_free;
6357 6357 }
6358 6358 }
6359 6359  
... ... @@ -6372,7 +6372,7 @@
6372 6372 rc = bnx2x_setup_leading(bp);
6373 6373 if (rc) {
6374 6374 BNX2X_ERR("Setup leading failed!\n");
6375   - goto load_stop_netif;
  6375 + goto load_netif_stop;
6376 6376 }
6377 6377  
6378 6378 if (CHIP_IS_E1H(bp))
... ... @@ -6385,7 +6385,7 @@
6385 6385 for_each_nondefault_queue(bp, i) {
6386 6386 rc = bnx2x_setup_multi(bp, i);
6387 6387 if (rc)
6388   - goto load_stop_netif;
  6388 + goto load_netif_stop;
6389 6389 }
6390 6390  
6391 6391 if (CHIP_IS_E1(bp))
6392 6392  
6393 6393  
... ... @@ -6430,20 +6430,18 @@
6430 6430  
6431 6431 return 0;
6432 6432  
6433   -load_stop_netif:
  6433 +load_netif_stop:
6434 6434 for_each_queue(bp, i)
6435 6435 napi_disable(&bnx2x_fp(bp, i, napi));
6436   -
6437   -load_int_disable:
6438   - bnx2x_int_disable_sync(bp);
6439   -
6440   - /* Release IRQs */
6441   - bnx2x_free_irq(bp);
6442   -
  6436 +load_rings_free:
6443 6437 /* Free SKBs, SGEs, TPA pool and driver internals */
6444 6438 bnx2x_free_skbs(bp);
6445 6439 for_each_queue(bp, i)
6446 6440 bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
  6441 +load_int_disable:
  6442 + bnx2x_int_disable_sync(bp);
  6443 + /* Release IRQs */
  6444 + bnx2x_free_irq(bp);
6447 6445 load_error:
6448 6446 bnx2x_free_mem(bp);
6449 6447