net: macb: Fix mdio child node detection
Subsystems (3)
PATCH 1/1 net: macb: Fix mdio child node detection
Commit 4d98bb0d7ec2 ("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.
--- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +1 -1
@@ -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);
Signature · 1 line
2.33.0
Quoted 24 lines · Guenter Roeck
Commit
4d98bb0d7ec2("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 asmacb 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 4d98bb0d7ec2 ("net: macb: Use mdio child node for MDIO bus if it exists")Cc Sean Anderson <[email protected]>Cc Andrew Lunn <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/cadence/macb_main.c +0
-0
drivers/net/ethernet/cadence/macb_main.c static int macb_mdiobus_register(struct macb *bp) · line 907
Quoted 8 lines
drivers/net/ethernet/cadence/macb_main.c +1
-1@@ -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);
Thanks for catching this.
Quoted 9 lines · Guenter Roeck
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Commit
4d98bb0d7ec2("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 asmacb 10090000.ethernet eth0: Could not attach PHY (-19)
Quoted 7 lines
if there is no 'mdio' child node. Fix the code to actually check for the child node.
Fixes 4d98bb0d7ec2 ("net: macb: Use mdio child node for MDIO bus if it exists")Cc Sean Anderson <[email protected]>Cc Andrew Lunn <[email protected]>Signed-off-by Guenter Roeck <[email protected]>> ---
Patch solves the failure also on sama5d2_xplained. You can add:
Thank you,
Claudiu Beznea
Quoted 19 lines
drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/cadence/macb_main.c +1
-2@@ -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); --2.33.0
Nicolas Ferre
Acked-byQuoted 11 lines · On 27/10/2021 at 10:38, Claudiu Beznea - M18063 wrote:
Quoted 10 lines · Guenter Roeck
Commit
4d98bb0d7ec2("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 asmacb 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.
Quoted 8 lines
Quoted 4 lines
Fixes 4d98bb0d7ec2 ("net: macb: Use mdio child node for MDIO bus if it exists")Cc Sean Anderson <[email protected]>Cc Andrew Lunn <[email protected]>Signed-off-by Guenter Roeck <[email protected]>> ---Patch solves the failure also on
sama5d2_xplained. You can add:Tested-by Claudiu Beznea <[email protected]>
Guener, Claudiu, thanks so much!
Best regards,
Nicolas
Quoted 20 lines
Quoted 19 lines
drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/cadence/macb_main.c +1
-2@@ -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); --2.33.0
Signature · 1 line
Nicolas Ferre
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 26 Oct 2021 10:39:50 -0700 you wrote:
Commit
4d98bb0d7ec2("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 asmacb 10090000.ethernet eth0: Could not attach PHY (-19)
[...]
Here is the summary with links:
- net: macb: Fix mdio child node detection
https://git.kernel.org/netdev/net-next/c/8db3cbc50748
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html