Skip to content

Commit ea8318c

Browse files
dangowrtdavem330
authored andcommitted
net: phy: realtek: clear master_slave_state if link is down
rtlgen_decode_physr() which sets master_slave_state isn't called in case the link is down and other than rtlgen_read_status(), rtl822x_c45_read_status() doesn't implicitely clear master_slave_state. Avoid stale master_slave_state by always setting it to MASTER_SLAVE_STATE_UNKNOWN in rtl822x_c45_read_status() in case the link is down. Fixes: 081c9c0 ("net: phy: realtek: read duplex and gbit master from PHYSR register") Signed-off-by: Daniel Golle <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 34d5a86 commit ea8318c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/phy/realtek.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,10 @@ static int rtl822x_c45_read_status(struct phy_device *phydev)
10381038
if (ret < 0)
10391039
return ret;
10401040

1041-
if (!phydev->link)
1041+
if (!phydev->link) {
1042+
phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
10421043
return 0;
1044+
}
10431045

10441046
/* Read actual speed from vendor register. */
10451047
val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR);

0 commit comments

Comments
 (0)