[PATCH] net: mdio: Do not warn about invalid PHY address

Sascha Hauer s.hauer at pengutronix.de
Mon Sep 17 04:31:23 PDT 2018


of_mdiobus_register is now called with nodes from ethernet devices.
Their child nodes are not necessarily phy nodes. For am335x devices
we get several warnings now:

miibus0: /ocp/ethernet at 4a100000/mdio at 4a101000 PHY address 1242566656 is too large
miibus0: /ocp/ethernet at 4a100000/slave at 4a100200 has invalid PHY address
miibus0: /ocp/ethernet at 4a100000/slave at 4a100300 has invalid PHY address
miibus0: /ocp/ethernet at 4a100000/cpsw-phy-sel at 44e10650 PHY address 1155597904 is too large

None of the nodes is a phy node, so silence the warnings and turn them
into dev_dbg.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/net/phy/mdio_bus.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 02e47f6a14..7d53bcc3da 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -179,9 +179,12 @@ static int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 
 	/* Loop over the child nodes and register a phy_device for each one */
 	for_each_available_child_of_node(np, child) {
+		if (!of_mdiobus_child_is_phy(child))
+			continue;
+
 		ret = of_property_read_u32(child, "reg", &addr);
 		if (ret) {
-			dev_err(&mdio->dev, "%s has invalid PHY address\n",
+			dev_dbg(&mdio->dev, "%s has invalid PHY address\n",
 				child->full_name);
 			continue;
 		}
@@ -192,9 +195,6 @@ static int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 			continue;
 		}
 
-		if (!of_mdiobus_child_is_phy(child))
-			continue;
-
 		of_mdiobus_reset_phy(mdio, child);
 		of_mdiobus_register_phy(mdio, child, addr);
 	}
-- 
2.19.0




More information about the barebox mailing list