ar71xx: ag71xx: Fix broken networking on some devices (FS#2177)
authorPetr Štetiar <ynezz@true.cz>
Wed, 3 Apr 2019 08:05:26 +0000 (10:05 +0200)
committerPetr Štetiar <ynezz@true.cz>
Mon, 8 Apr 2019 16:37:04 +0000 (18:37 +0200)
It was reported, that latest ar71xx builds have broken networking on
TP-Link TL-WPA8630 and Nanostation M5 XW devices and that by reverting
the offending commit, everything is back to normal.

Fixes: d3506d1 ("ar71xx: ag71xx: fix compile error when enabling debug")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c

index e92798ceb8975618b8cb2d4b9321402833e97b1e..336143f753d4d07ce66dd55942c29d08a37877e7 100644 (file)
@@ -127,12 +127,13 @@ static int ag71xx_phy_connect_multi(struct ag71xx *ag)
                if (ag->mii_bus->mdio_map[phy_addr] == NULL)
                        continue;
 
-               phydev = mdiobus_get_phy(ag->mii_bus, phy_addr);
-
                DBG("%s: PHY found at %s, uid=%08x\n",
                dev_name(dev),
                dev_name(&ag->mii_bus->mdio_map[phy_addr]->dev),
                (phydev) ? phydev->phy_id : 0);
+
+               if (phydev == NULL)
+                       phydev = mdiobus_get_phy(ag->mii_bus, phy_addr);
 #endif
        }