Skip to contentSkip to conversation

net: phy: Add missing driver check in phy_aneg_done()

PATCH Applied Florian Fainelli 2 participants 2 messages Feb 23, 2017 – Feb 24, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: Add missing driver check in phy_aneg_done()

Dan's static checker caught a potential code path in phy_state_machine() where we were not checking phydev->drv which is in phy_aneg_done().

Fixes 25149ef9d25c ("net: phy: Check phydev->drv")
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
index d6f7838455dd..1be69d8bc909 100644
@@ -146,7 +146,7 @@ static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
  */
 int phy_aneg_done(struct phy_device *phydev)
 {
-	if (phydev->drv->aneg_done)
+	if (phydev->drv && phydev->drv->aneg_done)
 		return phydev->drv->aneg_done(phydev);
 
 	return genphy_aneg_done(phydev);
Signature · 1 line
2.9.3