Commit c971c0e5 authored by David S. Miller's avatar David S. Miller

Merge branch 'get_phy_device-retval'

Sergei Shtylyov says:

====================
Don't return NULL from get_phy_device() anymore

   Here's the set of 5 patches against DaveM's 'net-next.git' repo. The first
patch makes get_phy_device() return only error values on error, the rest of
the patches clean up the callers of that function...
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents f7967210 af5840a9
...@@ -824,7 +824,7 @@ static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata, ...@@ -824,7 +824,7 @@ static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata,
return -EINVAL; return -EINVAL;
phy = get_phy_device(mdio, phy_id, false); phy = get_phy_device(mdio, phy_id, false);
if (!phy || IS_ERR(phy)) if (IS_ERR(phy))
return -EIO; return -EIO;
ret = phy_device_register(phy); ret = phy_device_register(phy);
......
...@@ -328,7 +328,7 @@ struct phy_device *fixed_phy_register(unsigned int irq, ...@@ -328,7 +328,7 @@ struct phy_device *fixed_phy_register(unsigned int irq,
return ERR_PTR(ret); return ERR_PTR(ret);
phy = get_phy_device(fmb->mii_bus, phy_addr, false); phy = get_phy_device(fmb->mii_bus, phy_addr, false);
if (!phy || IS_ERR(phy)) { if (IS_ERR(phy)) {
fixed_phy_del(phy_addr); fixed_phy_del(phy_addr);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
......
...@@ -419,7 +419,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) ...@@ -419,7 +419,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr)
int err; int err;
phydev = get_phy_device(bus, addr, false); phydev = get_phy_device(bus, addr, false);
if (IS_ERR(phydev) || phydev == NULL) if (IS_ERR(phydev))
return phydev; return phydev;
/* /*
......
...@@ -529,7 +529,7 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) ...@@ -529,7 +529,7 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
/* If the phy_id is mostly Fs, there is no device there */ /* If the phy_id is mostly Fs, there is no device there */
if ((phy_id & 0x1fffffff) == 0x1fffffff) if ((phy_id & 0x1fffffff) == 0x1fffffff)
return NULL; return ERR_PTR(-ENODEV);
return phy_device_create(bus, addr, phy_id, is_c45, &c45_ids); return phy_device_create(bus, addr, phy_id, is_c45, &c45_ids);
} }
......
...@@ -56,7 +56,7 @@ static void of_mdiobus_register_phy(struct mii_bus *mdio, ...@@ -56,7 +56,7 @@ static void of_mdiobus_register_phy(struct mii_bus *mdio,
phy = phy_device_create(mdio, addr, phy_id, 0, NULL); phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
else else
phy = get_phy_device(mdio, addr, is_c45); phy = get_phy_device(mdio, addr, is_c45);
if (IS_ERR_OR_NULL(phy)) if (IS_ERR(phy))
return; return;
rc = irq_of_parse_and_map(child, 0); rc = irq_of_parse_and_map(child, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment