Skip to content

Commit

Permalink
net: macb: Fix mdio child node detection
Browse files Browse the repository at this point in the history
Commit 4d98bb0 ("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: 4d98bb0 ("net: macb: Use mdio child node for MDIO bus if it exists")
Cc: Andrew Lunn <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Reviewed-by: Sean Anderson <[email protected]>
Tested-by: Claudiu Beznea <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
groeck authored and kuba-moo committed Oct 28, 2021
1 parent 85c0c3e commit 8db3cbc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/cadence/macb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8db3cbc

Please sign in to comment.