diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2024-10-03 22:03:21 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-10-05 02:19:00 +0300 |
commit | 9234a2549cb6ac038bec36cc7c084218e9575513 (patch) | |
tree | d0be179769b33bd678a75ff2fb13ce9f85f531dc /drivers/net/phy | |
parent | 1dae9f1187189bc09ff6d25ca97ead711f7e26f9 (diff) | |
download | linux-9234a2549cb6ac038bec36cc7c084218e9575513.tar.xz |
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: 75f4d8d10e01 ("net: phy: add Broadcom BCM84881 PHY driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/3e1755b0c40340d00e089d6adae5bca2f8c79e53.1727982168.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/bcm84881.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/phy/bcm84881.c b/drivers/net/phy/bcm84881.c index f1d47c264058..97da3aee4942 100644 --- a/drivers/net/phy/bcm84881.c +++ b/drivers/net/phy/bcm84881.c @@ -132,7 +132,7 @@ static int bcm84881_aneg_done(struct phy_device *phydev) bmsr = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_C22 + MII_BMSR); if (bmsr < 0) - return val; + return bmsr; return !!(val & MDIO_AN_STAT1_COMPLETE) && !!(bmsr & BMSR_ANEGCOMPLETE); @@ -158,7 +158,7 @@ static int bcm84881_read_status(struct phy_device *phydev) bmsr = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_C22 + MII_BMSR); if (bmsr < 0) - return val; + return bmsr; phydev->autoneg_complete = !!(val & MDIO_AN_STAT1_COMPLETE) && !!(bmsr & BMSR_ANEGCOMPLETE); |