netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Jeremy Linton <jeremy.linton@arm.com>
Cc: netdev@vger.kernel.org, steve.glendinning@shawell.net,
	sergei.shtylyov@cogentembedded.com
Subject: Re: [PATCH 1/2] net: smsc911x: Fix register_netdev, phy startup, driver unload ordering
Date: Thu, 1 Sep 2016 18:58:06 +0200	[thread overview]
Message-ID: <20160901165806.GC10951@lunn.ch> (raw)
In-Reply-To: <1472747141-15886-2-git-send-email-jeremy.linton@arm.com>

> @@ -1520,17 +1513,22 @@ 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*/
> +	/* find and start the given phy */
>  	if (!dev->phydev) {
> -		SMSC_WARN(pdata, hw, "phy_dev is NULL");
> -		return -EAGAIN;
> +		if (smsc911x_mii_probe(dev) < 0) {
> +			SMSC_WARN(pdata, probe, "Error starting phy");
> +			retval = -EAGAIN;

smsc911x_mii_probe() returns an error code. It is better to use that,
than -EAGAIN, which is rather odd to start with.

> +			goto out;
> +		}
>  	}
>  
>  	/* Reset the LAN911x */
>  	if (smsc911x_soft_reset(pdata)) {
>  		SMSC_WARN(pdata, hw, "soft reset failed");
> -		return -EIO;
> +		retval = -EIO;
> +		goto mii_free_out;

smsc911x_soft_reset() also returns an error code you should use.

This patch also seems to do quite a few different things. Please can
you break it up into multiple patches.

Thanks
	Andrew

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

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01 16:25 [PATCH 0/2] net: smsc911x: Move phy and interrupt config Jeremy Linton
2016-09-01 16:25 ` [PATCH 1/2] net: smsc911x: Fix register_netdev, phy startup, driver unload ordering Jeremy Linton
2016-09-01 16:58   ` Andrew Lunn [this message]
2016-09-01 18:42     ` Jeremy Linton
2016-09-01 19:22       ` Andrew Lunn
2016-09-01 16:25 ` [PATCH 2/2] net/smsc911x: Move interrupt allocation to open/stop Jeremy Linton
2016-09-01 17:06   ` Andrew Lunn
2016-09-01 18:47     ` Jeremy Linton
2016-09-01 19:45       ` Andrew Lunn
2016-09-01 20:39         ` Jeremy Linton

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=20160901165806.GC10951@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=jeremy.linton@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=steve.glendinning@shawell.net \
    /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).