Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: of_mdio: fix of_set_phy_supported after driver probing

Commit 8fdade4 ("net: of_mdio: parse "max-speed" property to set PHY
supported features") introduced a typo in of_set_phy_supported for the
first assignment of phydev->supported which will not effectively limit
the PHY device supported features bits if the PHY driver contains
"higher" features (e.g: max-speed = <100> and PHY driver has
PHY_GBIT_FEATURES set).

Fix this by making sure that the very first thing is to reset to sane
defaults (PHY_BASIC_FEATURES) and then progressively add speed features
as we parse them.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florian Fainelli and committed by
David S. Miller
ce11c436 d43ff4cd

+5 -1
+5 -1
drivers/of/of_mdio.c
··· 24 24 25 25 static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed) 26 26 { 27 - phydev->supported |= PHY_DEFAULT_FEATURES; 27 + /* The default values for phydev->supported are provided by the PHY 28 + * driver "features" member, we want to reset to sane defaults fist 29 + * before supporting higher speeds. 30 + */ 31 + phydev->supported &= PHY_DEFAULT_FEATURES; 28 32 29 33 switch (max_speed) { 30 34 default: