From: Raffaele Recalcati <raffaele.recalcati@bticino.it>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] net/ethernet: ks8851_mll unregister_netdev() before freeing
Date: Wed, 6 Jun 2012 19:03:11 +0200 [thread overview]
Message-ID: <20120606170311.GB3382@recalcati> (raw)
In-Reply-To: <20120606063129.GA26829@elgon.mountain>
On 09:31 Wed 06 Jun , Dan Carpenter wrote:
> We added another error condition here, but if we were to hit it then
> we need to unregister_netdev() before doing the free_netdev().
> Otherwise we would hit the BUG_ON() in free_netdev():
>
> BUG_ON(dev->reg_state != NETREG_UNREGISTERED);
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static checker stuff. I don't have this hardware.
>
> diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
> index 70bd329..875dd5e 100644
> --- a/drivers/net/ethernet/micrel/ks8851_mll.c
> +++ b/drivers/net/ethernet/micrel/ks8851_mll.c
> @@ -1606,7 +1606,7 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
> if (!pdata) {
> netdev_err(netdev, "No platform data\n");
> err = -ENODEV;
> - goto err_register;
> + goto err_pdata;
> }
> memcpy(ks->mac_addr, pdata->mac_addr, 6);
> if (!is_valid_ether_addr(ks->mac_addr)) {
> @@ -1626,6 +1626,8 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
> (id >> 8) & 0xff, (id >> 4) & 0xf, (id >> 1) & 0x7);
> return 0;
>
> +err_pdata:
> + unregister_netdev(netdev);
> err_register:
> err_get_irq:
> iounmap(ks->hw_addr_cmd);
Tested-by: Raffaele Recalcati <raffaele.recalcati@bticino.it>
[ 2.274993] ks8851_mll ks8851_mll: (unregistered net_device): message enable is 0
[ 2.282897] ks8851_mll ks8851_mll: (unregistered net_device): the selftest passes
[ 2.302246] ks8851_mll ks8851_mll: eth0: No platform data
next prev parent reply other threads:[~2012-06-06 17:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-06 6:31 [patch] net/ethernet: ks8851_mll unregister_netdev() before freeing Dan Carpenter
2012-06-06 17:03 ` Raffaele Recalcati [this message]
2012-06-07 20:15 ` David Miller
2012-06-08 12:53 ` Dan Carpenter
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=20120606170311.GB3382@recalcati \
--to=raffaele.recalcati@bticino.it \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--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