netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: macb: Fix mdio child node detection
@ 2021-10-26 17:39 Guenter Roeck
  2021-10-26 17:42 ` Sean Anderson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Guenter Roeck @ 2021-10-26 17:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Claudiu Beznea, David S . Miller, Jakub Kicinski, netdev,
	linux-kernel, Guenter Roeck, Sean Anderson, Andrew Lunn

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);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: macb: Fix mdio child node detection
  2021-10-26 17:39 [PATCH] net: macb: Fix mdio child node detection Guenter Roeck
@ 2021-10-26 17:42 ` Sean Anderson
  2021-10-27  8:38 ` Claudiu.Beznea
  2021-10-28  1:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Sean Anderson @ 2021-10-26 17:42 UTC (permalink / raw)
  To: Guenter Roeck, Nicolas Ferre
  Cc: Claudiu Beznea, David S . Miller, Jakub Kicinski, netdev,
	linux-kernel, Andrew Lunn



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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: macb: Fix mdio child node detection
  2021-10-26 17:39 [PATCH] net: macb: Fix mdio child node detection Guenter Roeck
  2021-10-26 17:42 ` Sean Anderson
@ 2021-10-27  8:38 ` Claudiu.Beznea
  2021-10-27  8:40   ` Nicolas Ferre
  2021-10-28  1:10 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Claudiu.Beznea @ 2021-10-27  8:38 UTC (permalink / raw)
  To: linux, Nicolas.Ferre
  Cc: davem, kuba, netdev, linux-kernel, sean.anderson, andrew

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
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: macb: Fix mdio child node detection
  2021-10-27  8:38 ` Claudiu.Beznea
@ 2021-10-27  8:40   ` Nicolas Ferre
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2021-10-27  8:40 UTC (permalink / raw)
  To: Claudiu Beznea - M18063, Guenter Roeck
  Cc: David S . Miller, Jakub Kicinski, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Sean Anderson, Andrew Lunn

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
>>
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: macb: Fix mdio child node detection
  2021-10-26 17:39 [PATCH] net: macb: Fix mdio child node detection Guenter Roeck
  2021-10-26 17:42 ` Sean Anderson
  2021-10-27  8:38 ` Claudiu.Beznea
@ 2021-10-28  1:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-28  1:10 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, netdev, linux-kernel,
	sean.anderson, andrew

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-28  1:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-26 17:39 [PATCH] net: macb: Fix mdio child node detection Guenter Roeck
2021-10-26 17:42 ` Sean Anderson
2021-10-27  8:38 ` Claudiu.Beznea
2021-10-27  8:40   ` Nicolas Ferre
2021-10-28  1:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).