[<prev] [next>] [day] [month] [year] [list]
Message-ID: <YZqBbvbBrj3OAz4i@shell.armlinux.org.uk>
Date: Sun, 21 Nov 2021 17:27:10 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Landen Chao <landen.chao@...iatek.com>,
Sean Wang <sean.wang@...iatek.com>
Cc: netdev@...r.kernel.org
Subject: mt753x DSA switch support - bug?
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!
Powered by blists - more mailing lists