From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Simon Horman <simon.horman@corigine.com>
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [RFC PATCH net-next] net: dsa: replace NETDEV_PRE_CHANGE_HWTSTAMP notifier with a stub
Date: Wed, 5 Apr 2023 23:31:07 +0300 [thread overview]
Message-ID: <20230405203107.lsz53fbu257d3pmc@skbuf> (raw)
In-Reply-To: <ZC3Ue5i/zjZkvMGy@corigine.com>
On Wed, Apr 05, 2023 at 10:05:15PM +0200, Simon Horman wrote:
> > +static inline int dsa_master_hwtstamp_validate(struct net_device *dev,
> > + const struct kernel_hwtstamp_config *config,
> > + struct netlink_ext_ack *extack)
> > +{
> > + int err;
> > +
> > + if (!netdev_uses_dsa(dev))
> > + return 0;
> > +
> > + mutex_lock(&dsa_stubs_lock);
> > +
> > + if (dsa_stubs)
> > + err = dsa_stubs->master_hwtstamp_validate(dev, config, extack);
> > +
> > + mutex_unlock(&dsa_stubs_lock);
>
> nit: clang-16 tells me that err is uninitialised here if dsa_stubs is false.
In fact, clang-16 is saying something much smarter than that, because I
did test this code path and it did work reliably (not like an uninitialized
return value would).
It's saying that when netdev_uses_dsa() returns true, the DSA module has
surely been loaded, so the stubs have surely been registered, so the
mutex_lock() and the check for the NULL quality of dsa_stubs are
completely redundant and can be removed.
> > +
> > + return err;
> > +}
> > +
> > +#else
next prev parent reply other threads:[~2023-04-05 20:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 16:51 [RFC PATCH net-next] net: dsa: replace NETDEV_PRE_CHANGE_HWTSTAMP notifier with a stub Vladimir Oltean
2023-04-05 16:56 ` Vladimir Oltean
2023-04-05 20:05 ` Simon Horman
2023-04-05 20:07 ` Vladimir Oltean
2023-04-05 20:08 ` Vladimir Oltean
2023-04-06 7:07 ` Simon Horman
2023-04-06 11:45 ` Vladimir Oltean
2023-04-05 20:31 ` Vladimir Oltean [this message]
2023-04-06 7:12 ` Simon Horman
2023-04-06 2:08 ` 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=20230405203107.lsz53fbu257d3pmc@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.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