netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, benli@broadcom.com,
	"Michael Chan" <mchan@broadcom.com>
Subject: [PATCH 7/8] bnx2: Cleanup error handling in bnx2_open().
Date: Wed, 18 Jun 2008 17:25:31 -0700	[thread overview]
Message-ID: <1213835132-5698-8-git-send-email-mchan@broadcom.com> (raw)
In-Reply-To: <1213835132-5698-1-git-send-email-mchan@broadcom.com>

All error handling in bnx2_open() can be consolidated.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
---
 drivers/net/bnx2.c |   37 ++++++++++++++-----------------------
 1 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 9a722bf..de4c85e 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
-- 
1.5.5.GIT




  parent reply	other threads:[~2008-06-19  0:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19  0:25 [PATCH 0/8] bnx2: Enable multi rx rings Michael Chan
2008-06-19  0:25 ` [PATCH 1/8] bnx2: Put tx ring variables in a separate struct Michael Chan
2008-06-19 23:39   ` David Miller
2008-06-19  0:25 ` [PATCH 2/8] bnx2: Put rx " Michael Chan
2008-06-19 23:39   ` David Miller
2008-06-19  0:25 ` [PATCH 3/8] bnx2: Optimize fast-path tx and rx work Michael Chan
2008-06-19 23:41   ` David Miller
2008-06-19  0:25 ` [PATCH 4/8] bnx2: Use one handler for all MSI-X vectors Michael Chan
2008-06-19 23:42   ` David Miller
2008-06-19  0:25 ` [PATCH 6/8] bnx2: Turn on multi rx rings Michael Chan
2008-06-19 23:43   ` David Miller
2008-06-19  0:25 ` Michael Chan [this message]
2008-06-19 23:44   ` [PATCH 7/8] bnx2: Cleanup error handling in bnx2_open() David Miller
2008-06-19  0:25 ` [PATCH 8/8] bnx2: Update driver version to 1.7.7 Michael Chan
2008-06-19 23:45   ` David Miller
     [not found] ` <1213835132-5698-6-git-send-email-mchan@broadcom.com>
2008-06-19 23:42   ` [PATCH 5/8] bnx2: Update firmware to support multi rx rings David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1213835132-5698-8-git-send-email-mchan@broadcom.com \
    --to=mchan@broadcom.com \
    --cc=benli@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).