From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Landen Chao <landen.chao@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>
Cc: netdev@vger.kernel.org
Subject: mt753x DSA switch support - bug?
Date: Sun, 21 Nov 2021 17:27:10 +0000 [thread overview]
Message-ID: <YZqBbvbBrj3OAz4i@shell.armlinux.org.uk> (raw)
Hi,
While updating drivers that use phylink, I came across this code in
the mt7530 driver in mt753x_phylink_validate():
if (state->interface != PHY_INTERFACE_MODE_TRGMII ||
!phy_interface_mode_is_8023z(state->interface)) {
phylink_set(mask, 10baseT_Half);
phylink_set(mask, 10baseT_Full);
phylink_set(mask, 100baseT_Half);
phylink_set(mask, 100baseT_Full);
phylink_set(mask, Autoneg);
}
which looks wrong to me. The if() condition is always true, so all
these modes are always set in the mask.
If state->interface is PHY_INTERFACE_MODE_TRGMII, then the first
part of the condition is false. phy_interface_mode_is_8023z() is
also false, so !phy_interface_mode_is_8023z() will be true. The
logical-or results in the if() condition being true.
If state->interface is PHY_INTERFACE_MODE_1000BASEX, then the first
part of the condition is true, and due to the logical-or not needing
to be further evaluated, results in the if() condition being true.
If state->interface is PHY_INTERFACE_MODE_RGMII, then the first part
of the condition is true, and this is exactly the same as the second
case above.
I think that "||" should be "&&", since I believe you intend these
modes not to be available in TRGMII nor 802.3z modes. Please confirm.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
reply other threads:[~2021-11-21 17:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=YZqBbvbBrj3OAz4i@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=landen.chao@mediatek.com \
--cc=netdev@vger.kernel.org \
--cc=sean.wang@mediatek.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).