From: David Miller <davem@davemloft.net>
To: sebastian@breakpoint.cc
Cc: ralf@linux-mips.org, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] net/sb1250: register mdio bus in probe
Date: Tue, 27 Apr 2010 15:52:15 -0700 (PDT) [thread overview]
Message-ID: <20100427.155215.228945283.davem@davemloft.net> (raw)
In-Reply-To: <1272229348-16140-1-git-send-email-sebastian@breakpoint.cc>
From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Date: Sun, 25 Apr 2010 23:02:27 +0200
> @@ -2389,9 +2387,23 @@ static int sbmac_init(struct platform_device *pldev, long long base)
> sc->mii_bus->irq[i] = SBMAC_PHY_INT;
>
> sc->mii_bus->parent = &pldev->dev;
> + /*
> + * Probe PHY address
> + */
> + err = mdiobus_register(sc->mii_bus);
> + if (err) {
> + printk(KERN_ERR "%s: unable to register MDIO bus\n",
> + dev->name);
> + goto free_mdio;
> + }
> dev_set_drvdata(&pldev->dev, sc->mii_bus);
> -
> return 0;
> +
> +free_mdio:
> + mdiobus_free(sc->mii_bus);
> +uninit_ctx:
> + sbmac_uninitctx(sc);
> + return err;
This is buggy, you're leaving the netdev registered in the
mdiobus_register() error path.
Furthermore, you really can't make any fail'able calls after
register_netdev() in your probe function. So you'll have to see if
you can do the mdiobus probe before that call.
Once the netdev is registered, it shows up in sysfs, udev can notice
it, and therefore code will try to bring the device up by calling the
device's open method, etc. Therefore, it really is a point of no
return.
next prev parent reply other threads:[~2010-04-27 22:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-25 21:02 [PATCH 1/2] net/sb1250: register mdio bus in probe Sebastian Andrzej Siewior
2010-04-25 21:02 ` [PATCH 2/2] net/sb1250: remove CONFIG_SIBYTE_STANDALONE Sebastian Andrzej Siewior
2010-04-27 22:54 ` David Miller
2010-04-27 22:52 ` David Miller [this message]
2010-04-28 19:57 ` [PATCH v2] net/sb1250: register mdio bus in probe Sebastian Andrzej Siewior
2010-04-28 21:32 ` 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=20100427.155215.228945283.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ralf@linux-mips.org \
--cc=sebastian@breakpoint.cc \
/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).