netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Linton <jeremy.linton@arm.com>
To: netdev@vger.kernel.org
Cc: steve.glendinning@shawell.net,
	sergei.shtylyov@cogentembedded.com, andrew@lunn.ch,
	will.deacon@arm.com
Subject: [PATCH 1/4] net: smsc911x: Remove multiple exit points from smsc911x_open
Date: Thu,  1 Sep 2016 15:15:06 -0500	[thread overview]
Message-ID: <1472760909-19688-2-git-send-email-jeremy.linton@arm.com> (raw)
In-Reply-To: <1472760909-19688-1-git-send-email-jeremy.linton@arm.com>

Rework the error handling in smsc911x open in preparation
for the mdio startup being moved here.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 drivers/net/ethernet/smsc/smsc911x.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index ca31345..c9b0e05 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1520,17 +1520,20 @@ static int smsc911x_open(struct net_device *dev)
 	unsigned int timeout;
 	unsigned int temp;
 	unsigned int intcfg;
+	int retval;
 
 	/* if the phy is not yet registered, retry later*/
 	if (!dev->phydev) {
 		SMSC_WARN(pdata, hw, "phy_dev is NULL");
-		return -EAGAIN;
+		retval = -EAGAIN;
+		goto out;
 	}
 
 	/* Reset the LAN911x */
-	if (smsc911x_soft_reset(pdata)) {
+	retval = smsc911x_soft_reset(pdata);
+	if (retval) {
 		SMSC_WARN(pdata, hw, "soft reset failed");
-		return -EIO;
+		goto out;
 	}
 
 	smsc911x_reg_write(pdata, HW_CFG, 0x00050000);
@@ -1600,7 +1603,8 @@ static int smsc911x_open(struct net_device *dev)
 	if (!pdata->software_irq_signal) {
 		netdev_warn(dev, "ISR failed signaling test (IRQ %d)\n",
 			    dev->irq);
-		return -ENODEV;
+		retval = -ENODEV;
+		goto out;
 	}
 	SMSC_TRACE(pdata, ifup, "IRQ handler passed test using IRQ %d",
 		   dev->irq);
@@ -1646,6 +1650,8 @@ static int smsc911x_open(struct net_device *dev)
 
 	netif_start_queue(dev);
 	return 0;
+out:
+	return retval;
 }
 
 /* Entry point for stopping the interface */
-- 
2.5.5

  reply	other threads:[~2016-09-01 21:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01 20:15 [PATCH v3 0/4] net: smsc911x: Move phy and interrupt config Jeremy Linton
2016-09-01 20:15 ` Jeremy Linton [this message]
2016-09-01 20:43   ` [PATCH 1/4] net: smsc911x: Remove multiple exit points from smsc911x_open Andrew Lunn
2016-09-01 20:15 ` [PATCH 2/4] net: smsc911x: Fix register_netdev, phy startup, driver unload ordering Jeremy Linton
2016-09-01 20:49   ` Andrew Lunn
2016-09-03 21:19   ` Sergei Shtylyov
2016-09-01 20:15 ` [PATCH 3/4] net: smsc911x: Move interrupt handler before open Jeremy Linton
2016-09-01 20:50   ` Andrew Lunn
2016-09-01 20:15 ` [PATCH 4/4] net: smsc911x: Move interrupt allocation to open/stop Jeremy Linton
2016-09-01 20:56   ` Andrew Lunn
2016-09-02 16:53   ` Will Deacon
2016-09-03 19:23   ` Sergei Shtylyov
2016-09-03 20:30     ` Sergei Shtylyov
2016-09-04  2:45       ` Andrew Lunn
2016-09-01 21:07 ` [PATCH v3 0/4] net: smsc911x: Move phy and interrupt config Sergei Shtylyov
2016-09-03  0:28 ` 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=1472760909-19688-2-git-send-email-jeremy.linton@arm.com \
    --to=jeremy.linton@arm.com \
    --cc=andrew@lunn.ch \
    --cc=netdev@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=steve.glendinning@shawell.net \
    --cc=will.deacon@arm.com \
    /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).