Skip to contentSkip to conversation

mdio_bus: don't return NULL from mdiobus_scan()

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

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

PATCH 1/1 mdio_bus: don't return NULL from mdiobus_scan()

I've finally noticed that mdiobus_scan() also returns either NULL or error value on failure. Return ERR_PTR(-ENODEV) instead of NULL since this is the error value already filtered out by the callers that want to ignore the MDIO address scan failure...

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

 drivers/net/phy/mdio_bus.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/mdio_bus.c +1 -1
Index: net-next/drivers/net/phy/mdio_bus.c
===================================================================
@@ -435,7 +435,7 @@ struct phy_device *mdiobus_scan(struct m
 	err = phy_device_register(phydev);
 	if (err) {
 		phy_device_free(phydev);
-		return NULL;
+		return ERR_PTR(-ENODEV);
 	}
 
 	return phydev;
maintainer Applied
#1 lore raw

From: Sergei Shtylyov <[email protected]>
Date: Tue, 03 May 2016 23:14:41 +0300

Quoted 6 lines

I've finally noticed that mdiobus_scan() also returns either NULL or error value on failure. Return ERR_PTR(-ENODEV) instead of NULL since this is the error value already filtered out by the callers that want to ignore the MDIO address scan failure...

Applied.