ar8216: add adjust_link checking
authorPawel Dembicki <paweldembicki@gmail.com>
Sat, 17 Nov 2018 08:07:47 +0000 (08:07 +0000)
committerJohn Crispin <john@phrozen.org>
Mon, 26 Nov 2018 11:16:52 +0000 (12:16 +0100)
Driver crash when 'phydev->adjust_link' isn't provided.

This patch check if 'phydev->adjust_link' exist before
call the method.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
target/linux/generic/files/drivers/net/phy/ar8216.c

index 7512ee1..6869e1f 100644 (file)
@@ -2104,7 +2104,8 @@ ar8xxx_phy_read_status(struct phy_device *phydev)
 
        phydev->state = PHY_RUNNING;
        netif_carrier_on(phydev->attached_dev);
 
        phydev->state = PHY_RUNNING;
        netif_carrier_on(phydev->attached_dev);
-       phydev->adjust_link(phydev->attached_dev);
+       if (phydev->adjust_link)
+               phydev->adjust_link(phydev->attached_dev);
 
        return 0;
 }
 
        return 0;
 }