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

net: phy: lan87xx: fix access to wrong register of LAN87xx

The function lan87xx_config_aneg_ext was introduced to configure
LAN95xxA but as well writes to undocumented register of LAN87xx.
This fix prevents that access.

The function lan87xx_config_aneg_ext gets more suitable for the new
behavior name.

Reported-by: Måns Rullgård <mans@mansr.com>
Fixes: 05b35e7eb9a1 ("smsc95xx: add phylib support")
Signed-off-by: Andre Edich <andre.edich@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andre Edich and committed by
David S. Miller
fdb5cc6a 9c0ee085

+5 -2
+5 -2
drivers/net/phy/smsc.c
··· 185 185 return genphy_config_aneg(phydev); 186 186 } 187 187 188 - static int lan87xx_config_aneg_ext(struct phy_device *phydev) 188 + static int lan95xx_config_aneg_ext(struct phy_device *phydev) 189 189 { 190 190 int rc; 191 + 192 + if (phydev->phy_id != 0x0007c0f0) /* not (LAN9500A or LAN9505A) */ 193 + return lan87xx_config_aneg(phydev); 191 194 192 195 /* Extend Manual AutoMDIX timer */ 193 196 rc = phy_read(phydev, PHY_EDPD_CONFIG); ··· 444 441 .read_status = lan87xx_read_status, 445 442 .config_init = smsc_phy_config_init, 446 443 .soft_reset = smsc_phy_reset, 447 - .config_aneg = lan87xx_config_aneg_ext, 444 + .config_aneg = lan95xx_config_aneg_ext, 448 445 449 446 /* IRQ related */ 450 447 .config_intr = smsc_phy_config_intr,