* [PATCH net] net: lan966x: check devm_of_phy_get() for -EDEFER_PROBE
@ 2022-05-25 23:12 Michael Walle
2022-05-27 4:48 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 4+ messages in thread
From: Michael Walle @ 2022-05-25 23:12 UTC (permalink / raw)
To: Horatiu Vultur, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: netdev, linux-kernel, UNGLinuxDriver, Michael Walle
At the moment, if devm_of_phy_get() returns an error the serdes
simply isn't set. While it is bad to ignore an error in general, there
is a particular bug that network isn't working if the serdes driver is
compiled as a module. In that case, devm_of_phy_get() returns
-EDEFER_PROBE and the error is silently ignored.
The serdes is optional, it is not there if the port is using RGMII, in
which case devm_of_phy_get() returns -ENODEV. Rearrange the error
handling so that -ENODEV will be handled but other error codes will
abort the probing.
Fixes: d28d6d2e37d1 ("net: lan966x: add port module support")
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 6ad68b422129..5784c4161e5e 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -1120,8 +1120,13 @@ static int lan966x_probe(struct platform_device *pdev)
lan966x->ports[p]->fwnode = fwnode_handle_get(portnp);
serdes = devm_of_phy_get(lan966x->dev, to_of_node(portnp), NULL);
- if (!IS_ERR(serdes))
- lan966x->ports[p]->serdes = serdes;
+ if (PTR_ERR(serdes) == -ENODEV)
+ serdes = NULL;
+ if (IS_ERR(serdes)) {
+ err = PTR_ERR(serdes);
+ goto cleanup_ports;
+ }
+ lan966x->ports[p]->serdes = serdes;
lan966x_port_init(lan966x->ports[p]);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: lan966x: check devm_of_phy_get() for -EDEFER_PROBE
2022-05-25 23:12 [PATCH net] net: lan966x: check devm_of_phy_get() for -EDEFER_PROBE Michael Walle
@ 2022-05-27 4:48 ` patchwork-bot+netdevbpf
2022-05-27 7:54 ` Michael Walle
0 siblings, 1 reply; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-27 4:48 UTC (permalink / raw)
To: Michael Walle
Cc: horatiu.vultur, davem, edumazet, kuba, pabeni, netdev,
linux-kernel, UNGLinuxDriver
Hello:
This patch was applied to bpf/bpf.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 26 May 2022 01:12:39 +0200 you wrote:
> At the moment, if devm_of_phy_get() returns an error the serdes
> simply isn't set. While it is bad to ignore an error in general, there
> is a particular bug that network isn't working if the serdes driver is
> compiled as a module. In that case, devm_of_phy_get() returns
> -EDEFER_PROBE and the error is silently ignored.
>
> The serdes is optional, it is not there if the port is using RGMII, in
> which case devm_of_phy_get() returns -ENODEV. Rearrange the error
> handling so that -ENODEV will be handled but other error codes will
> abort the probing.
>
> [...]
Here is the summary with links:
- [net] net: lan966x: check devm_of_phy_get() for -EDEFER_PROBE
https://git.kernel.org/bpf/bpf/c/b58cdd4388b1
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] 4+ messages in thread
* Re: [PATCH net] net: lan966x: check devm_of_phy_get() for -EDEFER_PROBE
2022-05-27 4:48 ` patchwork-bot+netdevbpf
@ 2022-05-27 7:54 ` Michael Walle
2022-05-27 22:52 ` Jakub Kicinski
0 siblings, 1 reply; 4+ messages in thread
From: Michael Walle @ 2022-05-27 7:54 UTC (permalink / raw)
To: kuba
Cc: horatiu.vultur, davem, edumazet, pabeni, netdev, linux-kernel,
UNGLinuxDriver
> This patch was applied to bpf/bpf.git (master)
bpf tree?
-michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: lan966x: check devm_of_phy_get() for -EDEFER_PROBE
2022-05-27 7:54 ` Michael Walle
@ 2022-05-27 22:52 ` Jakub Kicinski
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2022-05-27 22:52 UTC (permalink / raw)
To: Michael Walle
Cc: horatiu.vultur, davem, edumazet, pabeni, netdev, linux-kernel,
UNGLinuxDriver
On Fri, 27 May 2022 09:54:37 +0200 Michael Walle wrote:
> > This patch was applied to bpf/bpf.git (master)
>
> bpf tree?
Nah, treat pw-bot like a toddler who occasionally says the darndest
things. BPF and netdev share a patchwork instance. The BPF maintainers
probably forwarded their tree around the same time I pushed this patch
to net and the bot noticed it in their tree first.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-27 22:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 23:12 [PATCH net] net: lan966x: check devm_of_phy_get() for -EDEFER_PROBE Michael Walle
2022-05-27 4:48 ` patchwork-bot+netdevbpf
2022-05-27 7:54 ` Michael Walle
2022-05-27 22:52 ` Jakub Kicinski
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).