diff options
author | Madalin Bucur <madalin.bucur@nxp.com> | 2018-01-09 07:43:34 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-10 15:07:47 -0500 |
commit | 95f566de0269a0c59fd6a737a147731302136429 (patch) | |
tree | 773724e62075b36b4ece60979479b4a612435259 | |
parent | b0d55b5bc77755501be9de2c935d106ff8dba9ac (diff) |
of_mdio: avoid MDIO bus removal when a PHY is missing
If one of the child devices is missing the of_mdiobus_register_phy()
call will return -ENODEV. When a missing device is encountered the
registration of the remaining PHYs is stopped and the MDIO bus will
fail to register. Propagate all errors except ENODEV to avoid it.
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/of/of_mdio.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 3481e69738b5..a327be1d264b 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -231,7 +231,12 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
231 | rc = of_mdiobus_register_phy(mdio, child, addr); | 231 | rc = of_mdiobus_register_phy(mdio, child, addr); |
232 | else | 232 | else |
233 | rc = of_mdiobus_register_device(mdio, child, addr); | 233 | rc = of_mdiobus_register_device(mdio, child, addr); |
234 | if (rc) | 234 | |
235 | if (rc == -ENODEV) | ||
236 | dev_err(&mdio->dev, | ||
237 | "MDIO device at address %d is missing.\n", | ||
238 | addr); | ||
239 | else if (rc) | ||
235 | goto unregister; | 240 | goto unregister; |
236 | } | 241 | } |
237 | 242 | ||
@@ -255,7 +260,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
255 | 260 | ||
256 | if (of_mdiobus_child_is_phy(child)) { | 261 | if (of_mdiobus_child_is_phy(child)) { |
257 | rc = of_mdiobus_register_phy(mdio, child, addr); | 262 | rc = of_mdiobus_register_phy(mdio, child, addr); |
258 | if (rc) | 263 | if (rc && rc != -ENODEV) |
259 | goto unregister; | 264 | goto unregister; |
260 | } | 265 | } |
261 | } | 266 | } |