macb: fix mdiobus_scan() error check
authorSergei Shtylyov <[email protected]>
Sat, 30 Apr 2016 22:47:36 +0000 (01:47 +0300)
committerDavid S. Miller <[email protected]>
Tue, 3 May 2016 19:03:09 +0000 (15:03 -0400)
Now mdiobus_scan() returns ERR_PTR(-ENODEV) instead of NULL if the PHY
device ID was read as all ones. As this was not  an error before, this
value  should be filtered out now in this driver.

Fixes: b74766a0a0fe ("phylib: don't return NULL from get_phy_device()")
Signed-off-by: Sergei Shtylyov <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/ethernet/cadence/macb.c

index 48a7d7dee8461117b3f47bcbdebe4c0745385bf7..898f06f9e28682fe49da47291ce1ed28f4bf396f 100644 (file)
@@ -458,7 +458,8 @@ static int macb_mii_init(struct macb *bp)
                                struct phy_device *phydev;
 
                                phydev = mdiobus_scan(bp->mii_bus, i);
-                               if (IS_ERR(phydev)) {
+                               if (IS_ERR(phydev) &&
+                                   PTR_ERR(phydev) != -ENODEV) {
                                        err = PTR_ERR(phydev);
                                        break;
                                }