Commit 8db3cbc5 authored by Guenter Roeck's avatar Guenter Roeck Committed by Jakub Kicinski

net: macb: Fix mdio child node detection

Commit 4d98bb0d ("net: macb: Use mdio child node for MDIO bus if it
exists") added code to detect if a 'mdio' child node exists to the macb
driver. Ths added code does, however, not actually check if the child node
exists, but if the parent node exists. This results in errors such as

macb 10090000.ethernet eth0: Could not attach PHY (-19)

if there is no 'mdio' child node. Fix the code to actually check for
the child node.

Fixes: 4d98bb0d ("net: macb: Use mdio child node for MDIO bus if it exists")
Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Reviewed-by: default avatarSean Anderson <sean.anderson@seco.com>
Tested-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20211026173950.353636-1-linux@roeck-us.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 85c0c3eb
......@@ -901,7 +901,7 @@ static int macb_mdiobus_register(struct macb *bp)
* directly under the MAC node
*/
child = of_get_child_by_name(np, "mdio");
if (np) {
if (child) {
int ret = of_mdiobus_register(bp->mii_bus, child);
of_node_put(child);
......
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