diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2023-03-11 21:34:45 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-22 15:26:14 +0300 |
commit | 85f922f42399f779a440592944dd90fd4cf6ebcd (patch) | |
tree | 4a960bbd48c47da22bc13a663810b1afb10ea5c4 /drivers/net | |
parent | 8e206f66d824b3b28a7f9ee1366dfc79a937bb46 (diff) | |
download | linux-85f922f42399f779a440592944dd90fd4cf6ebcd.tar.xz |
net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
[ Upstream commit c22c3bbf351e4ce905f082649cffa1ff893ea8c1 ]
If genphy_read_status fails then further access to the PHY may result
in unpredictable behavior. To prevent this bail out immediately if
genphy_read_status fails.
Fixes: 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/026aa4f2-36f5-1c10-ab9f-cdb17dda6ac4@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/phy/smsc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 2306bfae057f..d5d96e728683 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -112,8 +112,11 @@ static int lan911x_config_init(struct phy_device *phydev) static int lan87xx_read_status(struct phy_device *phydev) { struct smsc_phy_priv *priv = phydev->priv; + int err; - int err = genphy_read_status(phydev); + err = genphy_read_status(phydev); + if (err) + return err; if (!phydev->link && priv->energy_enable) { int i; |