Skip to content

Commit

Permalink
net: phy: fix setting autoneg_complete in genphy_update_link
Browse files Browse the repository at this point in the history
The original patch didn't set phydev->autoneg_complete in one exit path.
Fix this.

Fixes: 4950c2b ("net: phy: fix autoneg mismatch case in genphy_read_status")
Reported-by: Simon Horman <horms@verge.net.au>
Tested-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Heiner Kallweit authored and David S. Miller committed Apr 8, 2019
1 parent 13ee7d4 commit b7f29f8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1710,19 +1710,17 @@ int genphy_update_link(struct phy_device *phydev)
*/
if (!phy_polling_mode(phydev)) {
status = phy_read(phydev, MII_BMSR);
if (status < 0) {
if (status < 0)
return status;
} else if (status & BMSR_LSTATUS) {
phydev->link = 1;
return 0;
}
else if (status & BMSR_LSTATUS)
goto done;
}

/* Read link and autonegotiation status */
status = phy_read(phydev, MII_BMSR);
if (status < 0)
return status;

done:
phydev->link = status & BMSR_LSTATUS ? 1 : 0;
phydev->autoneg_complete = status & BMSR_ANEGCOMPLETE ? 1 : 0;

Expand Down

0 comments on commit b7f29f8

Please sign in to comment.