Skip to content

Commit 9234a25

Browse files
tititiou36kuba-moo
authored andcommitted
net: phy: bcm84881: Fix some error handling paths
If phy_read_mmd() fails, the error code stored in 'bmsr' should be returned instead of 'val' which is likely to be 0. Fixes: 75f4d8d ("net: phy: add Broadcom BCM84881 PHY driver") Signed-off-by: Christophe JAILLET <[email protected]> Link: https://patch.msgid.link/3e1755b0c40340d00e089d6adae5bca2f8c79e53.1727982168.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1dae9f1 commit 9234a25

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/phy/bcm84881.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int bcm84881_aneg_done(struct phy_device *phydev)
132132

133133
bmsr = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_C22 + MII_BMSR);
134134
if (bmsr < 0)
135-
return val;
135+
return bmsr;
136136

137137
return !!(val & MDIO_AN_STAT1_COMPLETE) &&
138138
!!(bmsr & BMSR_ANEGCOMPLETE);
@@ -158,7 +158,7 @@ static int bcm84881_read_status(struct phy_device *phydev)
158158

159159
bmsr = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_C22 + MII_BMSR);
160160
if (bmsr < 0)
161-
return val;
161+
return bmsr;
162162

163163
phydev->autoneg_complete = !!(val & MDIO_AN_STAT1_COMPLETE) &&
164164
!!(bmsr & BMSR_ANEGCOMPLETE);

0 commit comments

Comments
 (0)