From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernel-janitors@vger.kernel.org
Subject: Re: [bug report] net: phylink: use legacy_pre_march2020
Date: Wed, 15 Dec 2021 11:58:40 +0000 [thread overview]
Message-ID: <YbnYcFaMYR5AWr47@shell.armlinux.org.uk> (raw)
In-Reply-To: <20211215113539.GA14967@kili>
On Wed, Dec 15, 2021 at 02:35:39PM +0300, Dan Carpenter wrote:
> Hello Russell King (Oracle),
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 001f4261fe4d: "net: phylink: use legacy_pre_march2020" from
> Dec 9, 2021, leads to the following Smatch complaint:
>
> drivers/net/phy/phylink.c:823 phylink_change_inband_advert()
> error: we previously assumed 'pl->pcs_ops' could be null (see line 806)
>
> drivers/net/phy/phylink.c
> 805
> 806 if (!pl->pcs_ops && pl->config->legacy_pre_march2020) {
> ^^^^^^^^^^^^
> Should this be an ||?
No, the intention is correct, even though it looks a little weird.
We only call phylink_change_inband_advert() if we are in in-band mode,
and in-band mode for non-legacy users requires a PCS. Consequently, if
legacy_pre_march2020 is clear, we have no PCS, and we reach here, then
something is definitely broken.
There isn't an easy way to detect this condition earlier, but we could
do something like:
if (WARN_ON(!pl->pcs_ops))
return -EINVAL;
which should be sufficiently noisy for people to do something about.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
prev parent reply other threads:[~2021-12-15 11:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 11:35 [bug report] net: phylink: use legacy_pre_march2020 Dan Carpenter
2021-12-15 11:58 ` Russell King (Oracle) [this message]
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=YbnYcFaMYR5AWr47@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@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 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.