Commit c22c3bbf authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Jakub Kicinski

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: 4223dbff ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/026aa4f2-36f5-1c10-ab9f-cdb17dda6ac4@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 4b397c06
...@@ -199,8 +199,11 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev) ...@@ -199,8 +199,11 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev)
static int lan87xx_read_status(struct phy_device *phydev) static int lan87xx_read_status(struct phy_device *phydev)
{ {
struct smsc_phy_priv *priv = phydev->priv; 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 && phydev->irq == PHY_POLL) { if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) {
/* Disable EDPD to wake up PHY */ /* Disable EDPD to wake up PHY */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment