diff options
author | David S. Miller <davem@davemloft.net> | 2016-03-14 15:31:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-14 15:31:59 -0400 |
commit | dc91d7efdc0ea7c1ff242fea17e0122aaeb87dc5 (patch) | |
tree | 38974f25aeaadc628868e5f6b793ed9b62af2df2 /drivers | |
parent | 1f3a1c546615a2022c461c5e3458dd8a8f2f3aa1 (diff) | |
parent | 5189b1d82f1ce6c2749fa3499d28ffd3f5075543 (diff) | |
download | linux-dc91d7efdc0ea7c1ff242fea17e0122aaeb87dc5.tar.bz2 |
Merge branch 'of_mdio-checks'
Sergei Shtylyov says:
====================
of_mdio: use IS_ERR_OR_NULL() and PTR_ERR_OR_ZERO()
Here's the set of 3 patches against DaveM's 'net-next.git' repo. They deal
with some error checks in the device tree MDIO code...
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/of/of_mdio.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 5e7838290998..8453f08d2ef4 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -56,7 +56,7 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi phy = phy_device_create(mdio, addr, phy_id, 0, NULL); else phy = get_phy_device(mdio, addr, is_c45); - if (!phy || IS_ERR(phy)) + if (IS_ERR_OR_NULL(phy)) return 1; rc = irq_of_parse_and_map(child, 0); @@ -98,7 +98,7 @@ static int of_mdiobus_register_device(struct mii_bus *mdio, int rc; mdiodev = mdio_device_create(mdio, addr); - if (!mdiodev || IS_ERR(mdiodev)) + if (IS_ERR(mdiodev)) return 1; /* Associate the OF node with the device structure so it @@ -412,7 +412,7 @@ int of_phy_register_fixed_link(struct device_node *np) if (strcmp(managed, "in-band-status") == 0) { /* status is zeroed, namely its .link member */ phy = fixed_phy_register(PHY_POLL, &status, -1, np); - return IS_ERR(phy) ? PTR_ERR(phy) : 0; + return PTR_ERR_OR_ZERO(phy); } } @@ -434,7 +434,7 @@ int of_phy_register_fixed_link(struct device_node *np) return -EPROBE_DEFER; phy = fixed_phy_register(PHY_POLL, &status, link_gpio, np); - return IS_ERR(phy) ? PTR_ERR(phy) : 0; + return PTR_ERR_OR_ZERO(phy); } /* Old binding */ @@ -446,7 +446,7 @@ int of_phy_register_fixed_link(struct device_node *np) status.pause = be32_to_cpu(fixed_link_prop[3]); status.asym_pause = be32_to_cpu(fixed_link_prop[4]); phy = fixed_phy_register(PHY_POLL, &status, -1, np); - return IS_ERR(phy) ? PTR_ERR(phy) : 0; + return PTR_ERR_OR_ZERO(phy); } return -ENODEV; |