]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
net: phy: Add missing driver check in phy_aneg_done()
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 23 Feb 2017 22:22:19 +0000 (14:22 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Feb 2017 16:42:55 +0000 (11:42 -0500)
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>
drivers/net/phy/phy.c

index d6f7838455dd7874b61ddccb31ce70748145c8be..1be69d8bc90948e82f92736b8f7ee9d274b9bd2b 100644 (file)
@@ -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);