ar71xx: fix NULL pointer dereference in the ethernet driver
authorGabor Juhos <juhosg@openwrt.org>
Fri, 11 Dec 2009 19:32:58 +0000 (19:32 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Fri, 11 Dec 2009 19:32:58 +0000 (19:32 +0000)
SVN-Revision: 18755

target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c

index 547f72edba997e5c7414b399ed3a7f759577d762..4233152aec6117b266b0d6454af27ade7047952a 100644 (file)
@@ -309,9 +309,11 @@ int ag71xx_phy_connect(struct ag71xx *ag)
        }
 
        /* Reset the mdio bus explicitly */
-       mutex_lock(&ag->mii_bus->mdio_lock);
-       ag->mii_bus->reset(ag->mii_bus);
-       mutex_unlock(&ag->mii_bus->mdio_lock);
+       if (ag->mii_bus->reset) {
+               mutex_lock(&ag->mii_bus->mdio_lock);
+               ag->mii_bus->reset(ag->mii_bus);
+               mutex_unlock(&ag->mii_bus->mdio_lock);
+       }
 
        if (pdata->phy_mask)
                return ag71xx_phy_connect_multi(ag);