netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, andrew@lunn.ch, opendmb@gmail.com
Subject: Re: [PATCH net] net: dsa: Unregister slave_dev in error path
Date: Wed, 17 Feb 2016 18:28:22 -0800	[thread overview]
Message-ID: <56C52C46.6070203@gmail.com> (raw)
In-Reply-To: <1455761951-26408-1-git-send-email-f.fainelli@gmail.com>

Le 17/02/2016 18:19, Florian Fainelli a écrit :
> With commit 0071f56e46da ("dsa: Register netdev before phy"), we are now trying
> to unregister

s/unregister/free/...

 a network device that has been previously registered, and in case
> of errors, this will make us hit the BUG_ON(dev->reg_state !=
> NETREG_UNREGISTERED) condition.
> 
> Fix this by adding a missing unregister_netdev() before free_netdev().
> 
> Fixes: 0071f56e46da ("dsa: Register netdev before phy")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  net/dsa/slave.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 40b9ca7..e685042 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -1205,6 +1205,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
>  	ret = dsa_slave_phy_setup(p, slave_dev);
>  	if (ret) {
>  		netdev_err(master, "error %d setting up slave phy\n", ret);
> +		unregister_netdev(slave_dev);
>  		free_netdev(slave_dev);
>  		return ret;
>  	}
> 


-- 
Florian

  reply	other threads:[~2016-02-18  2:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  2:19 [PATCH net] net: dsa: Unregister slave_dev in error path Florian Fainelli
2016-02-18  2:28 ` Florian Fainelli [this message]
2016-02-18  2:43 ` [PATCH net v2] " Florian Fainelli
2016-02-18  3:05   ` 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=56C52C46.6070203@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.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).