Sfoglia il codice sorgente

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().

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 25149ef9d25c ("net: phy: Check phydev->drv")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Florian Fainelli 8 anni fa
parent
commit
65f2767a64
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      drivers/net/phy/phy.c

+ 1 - 1
drivers/net/phy/phy.c

@@ -146,7 +146,7 @@ static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
  */
  */
 int phy_aneg_done(struct phy_device *phydev)
 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 phydev->drv->aneg_done(phydev);
 
 
 	return genphy_aneg_done(phydev);
 	return genphy_aneg_done(phydev);