All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	f.fainelli@gmail.com, vivien.didelot@gmail.com,
	xiyou.wangcong@gmail.com, ap420073@gmail.com
Subject: Re: [PATCH net] net: dsa: link interfaces with the DSA master to get rid of lockdep warnings
Date: Mon, 13 Jul 2020 18:47:28 +0200	[thread overview]
Message-ID: <20200713164728.GH1078057@lunn.ch> (raw)
In-Reply-To: <20200713162443.2510682-1-olteanv@gmail.com>

> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 743caabeaaa6..a951b2a7d79a 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -1994,6 +1994,13 @@ int dsa_slave_create(struct dsa_port *port)
>  			   ret, slave_dev->name);
>  		goto out_phy;
>  	}
> +	rtnl_lock();
> +	ret = netdev_upper_dev_link(master, slave_dev, NULL);
> +	rtnl_unlock();
> +	if (ret) {
> +		unregister_netdevice(slave_dev);
> +		goto out_phy;
> +	}

Hi Vladimir

A common pattern we see in bugs is that the driver sets up something
critical after calling register_netdev(), not realising that that call
can go off and really start using the interface before it returns. So
in general, i like to have register_netdev() last, nothing after it.

Please could you move this before register_netdev().

Thanks
	Andrew

  reply	other threads:[~2020-07-13 16:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 16:24 [PATCH net] net: dsa: link interfaces with the DSA master to get rid of lockdep warnings Vladimir Oltean
2020-07-13 16:47 ` Andrew Lunn [this message]
2020-07-13 17:30   ` Vladimir Oltean
2020-07-13 17:33     ` Vladimir Oltean
2020-07-13 17:42       ` Vladimir Oltean
2020-07-13 18:59         ` Andrew Lunn
2020-07-14  0:48         ` David Miller
2020-07-13 18:39 ` Florian Fainelli
2020-07-16 23:06 ` Jakub Kicinski

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=20200713164728.GH1078057@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    --cc=xiyou.wangcong@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.