diff mbox series

net: macb: Fix mdio child node detection

Message ID 20211026173950.353636-1-linux@roeck-us.net (mailing list archive)
State Accepted
Commit 8db3cbc50748fe0990bfaa7dea113406b416e70b
Delegated to: Netdev Maintainers
Headers show
Series net: macb: Fix mdio child node detection | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 25 this patch: 25
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Fixes tag looks correct
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 25 this patch: 25
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Guenter Roeck Oct. 26, 2021, 5:39 p.m. UTC
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.

Fixes: 4d98bb0d7ec2 ("net: macb: Use mdio child node for MDIO bus if it exists")
Cc: Sean Anderson <sean.anderson@seco.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/net/ethernet/cadence/macb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sean Anderson Oct. 26, 2021, 5:42 p.m. UTC | #1
On 10/26/21 1:39 PM, Guenter Roeck 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 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: 4d98bb0d7ec2 ("net: macb: Use mdio child node for MDIO bus if it exists")
> Cc: Sean Anderson <sean.anderson@seco.com>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>   drivers/net/ethernet/cadence/macb_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 309371abfe23..ffce528aa00e 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -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.

Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Claudiu Beznea Oct. 27, 2021, 8:38 a.m. UTC | #2
On 26.10.2021 20:39, Guenter Roeck wrote:
> 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 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: 4d98bb0d7ec2 ("net: macb: Use mdio child node for MDIO bus if it exists")
> Cc: Sean Anderson <sean.anderson@seco.com>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>> ---

Patch solves the failure also on sama5d2_xplained. You can add:

Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Thank you,
Claudiu Beznea

>  drivers/net/ethernet/cadence/macb_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 309371abfe23..ffce528aa00e 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -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 Oct. 27, 2021, 8:40 a.m. UTC | #3
On 27/10/2021 at 10:38, Claudiu Beznea - M18063 wrote:
> On 26.10.2021 20:39, Guenter Roeck 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 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: 4d98bb0d7ec2 ("net: macb: Use mdio child node for MDIO bus if it exists")
>> Cc: Sean Anderson <sean.anderson@seco.com>
>> Cc: Andrew Lunn <andrew@lunn.ch>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>> ---
> 
> Patch solves the failure also on sama5d2_xplained. You can add:
> 
> Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Guener, Claudiu, thanks so much!
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Best regards,
   Nicolas


>>   drivers/net/ethernet/cadence/macb_main.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
>> index 309371abfe23..ffce528aa00e 100644
>> --- a/drivers/net/ethernet/cadence/macb_main.c
>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>> @@ -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
>>
>
patchwork-bot+netdevbpf@kernel.org Oct. 28, 2021, 1:10 a.m. UTC | #4
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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 as
> 
> macb 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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 309371abfe23..ffce528aa00e 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -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);