Skip to content

Commit

Permalink
Merge branch 'get_phy_device-retval'
Browse files Browse the repository at this point in the history
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: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Apr 26, 2016
2 parents f796721 + af5840a commit c971c0e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata,
return -EINVAL;

phy = get_phy_device(mdio, phy_id, false);
if (!phy || IS_ERR(phy))
if (IS_ERR(phy))
return -EIO;

ret = phy_device_register(phy);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/phy/fixed_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ struct phy_device *fixed_phy_register(unsigned int irq,
return ERR_PTR(ret);

phy = get_phy_device(fmb->mii_bus, phy_addr, false);
if (!phy || IS_ERR(phy)) {
if (IS_ERR(phy)) {
fixed_phy_del(phy_addr);
return ERR_PTR(-EINVAL);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr)
int err;

phydev = get_phy_device(bus, addr, false);
if (IS_ERR(phydev) || phydev == NULL)
if (IS_ERR(phydev))
return phydev;

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ((phy_id & 0x1fffffff) == 0x1fffffff)
return NULL;
return ERR_PTR(-ENODEV);

return phy_device_create(bus, addr, phy_id, is_c45, &c45_ids);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/of_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void of_mdiobus_register_phy(struct mii_bus *mdio,
phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
else
phy = get_phy_device(mdio, addr, is_c45);
if (IS_ERR_OR_NULL(phy))
if (IS_ERR(phy))
return;

rc = irq_of_parse_and_map(child, 0);
Expand Down

0 comments on commit c971c0e

Please sign in to comment.