Skip to contentSkip to conversation

macb: fix mdiobus_scan() error check

PATCH Applied Sergei Shtylyov 4 participants 4 messages Apr 30, 2016 – May 3, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 macb: fix mdiobus_scan() error check

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()")

---
The patch is against DaveM's 'net-next.git' repo.

 drivers/net/ethernet/cadence/macb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb.c +2 -1
Index: net-next/drivers/net/ethernet/cadence/macb.c
===================================================================
@@ -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;
 				}
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Sergei Shtylyov

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()")
Signature · 1 line
Florian
Acked-by on v1 1/1
#2 lore raw
In reply to Sergei Shtylyov
Quoted 6 lines · Sergei Shtylyov

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()")

Thanks.

Quoted 23 lines

---
The patch is against DaveM's 'net-next.git' repo.

 drivers/net/ethernet/cadence/macb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: net-next/drivers/net/ethernet/cadence/macb.c
===================================================================

drivers/net/ethernet/cadence/macb.c +2 -1
@@ -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;
 				}
Signature · 1 line
Nicolas Ferre
maintainer Applied
#3 lore raw
In reply to Sergei Shtylyov

From: Sergei Shtylyov <[email protected]>
Date: Sun, 01 May 2016 01:47:36 +0300

Quoted 6 lines

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()")

Applied.