Skip to contentSkip to conversation

net: phy: fix wrong mask to phy_modify()

PATCH In review Ingo van Lil 3 participants 3 messages Feb 12, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: fix wrong mask to phy_modify()

When forcing a specific link mode, the PHY driver must clear the existing speed and duplex bits in BMCR while preserving some other control bits. This logic was accidentally inverted with the introduction of phy_modify().

---
 drivers/net/phy/phy_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +1 -1
index b13eed21c87d..d39ae77707ef 100644
@@ -1382,7 +1382,7 @@ int genphy_setup_forced(struct phy_device *phydev)
 		ctl |= BMCR_FULLDPLX;
 
 	return phy_modify(phydev, MII_BMCR,
-			  BMCR_LOOPBACK | BMCR_ISOLATE | BMCR_PDOWN, ctl);
+			  ~(BMCR_LOOPBACK | BMCR_ISOLATE | BMCR_PDOWN), ctl);
 }
 EXPORT_SYMBOL(genphy_setup_forced);
 
Signature · 1 line
2.14.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Ingo van Lil

When forcing a specific link mode, the PHY driver must clear the existing speed and duplex bits in BMCR while preserving some other control bits. This logic was accidentally inverted with the introduction of phy_modify().

Fixes fea23fb591cc ("net: phy: convert read-modify-write to phy_modify()")

Andrew