ar8216: add adjust_link checking

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>
This commit is contained in:
Pawel Dembicki 2018-11-17 08:07:47 +00:00 committed by John Crispin
parent ed25e3ac02
commit e61812fd34
1 changed files with 2 additions and 1 deletions

View File

@ -2104,7 +2104,8 @@ ar8xxx_phy_read_status(struct phy_device *phydev)
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;
}