Skip to content

Commit c22c3bb

Browse files
hkallweitkuba-moo
authored andcommitted
net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
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: 4223dbf ("net: phy: smsc: Re-enable EDPD mode for LAN87xx") Signed-off-by: Heiner Kallweit <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4b397c0 commit c22c3bb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/phy/smsc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,11 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev)
199199
static int lan87xx_read_status(struct phy_device *phydev)
200200
{
201201
struct smsc_phy_priv *priv = phydev->priv;
202+
int err;
202203

203-
int err = genphy_read_status(phydev);
204+
err = genphy_read_status(phydev);
205+
if (err)
206+
return err;
204207

205208
if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) {
206209
/* Disable EDPD to wake up PHY */

0 commit comments

Comments
 (0)