From: Michael Chan Date: Thu, 19 Jun 2008 23:44:10 +0000 (-0700) Subject: bnx2: Cleanup error handling in bnx2_open(). X-Git-Tag: v2.6.27-rc1~964^2~275 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2739a8bb5b13653999827da09565b1bca5cec67d;p=platform%2Fkernel%2Flinux-stable.git bnx2: Cleanup error handling in bnx2_open(). All error handling in bnx2_open() can be consolidated. Signed-off-by: Michael Chan Signed-off-by: Benjamin Li Signed-off-by: David S. Miller --- diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 3b90719..d4be238 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -5773,29 +5773,16 @@ bnx2_open(struct net_device *dev) bnx2_setup_int_mode(bp, disable_msi); bnx2_napi_enable(bp); rc = bnx2_alloc_mem(bp); - if (rc) { - bnx2_napi_disable(bp); - bnx2_free_mem(bp); - return rc; - } + if (rc) + goto open_err; rc = bnx2_request_irq(bp); - - if (rc) { - bnx2_napi_disable(bp); - bnx2_free_mem(bp); - return rc; - } + if (rc) + goto open_err; rc = bnx2_init_nic(bp, 1); - - if (rc) { - bnx2_napi_disable(bp); - bnx2_free_irq(bp); - bnx2_free_skbs(bp); - bnx2_free_mem(bp); - return rc; - } + if (rc) + goto open_err; mod_timer(&bp->timer, jiffies + bp->current_interval); @@ -5825,11 +5812,8 @@ bnx2_open(struct net_device *dev) rc = bnx2_request_irq(bp); if (rc) { - bnx2_napi_disable(bp); - bnx2_free_skbs(bp); - bnx2_free_mem(bp); del_timer_sync(&bp->timer); - return rc; + goto open_err; } bnx2_enable_int(bp); } @@ -5842,6 +5826,13 @@ bnx2_open(struct net_device *dev) netif_start_queue(dev); return 0; + +open_err: + bnx2_napi_disable(bp); + bnx2_free_skbs(bp); + bnx2_free_irq(bp); + bnx2_free_mem(bp); + return rc; } static void