* [PATCH net v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind
@ 2026-06-17 19:32 Ruoyu Wang
2026-06-18 8:18 ` Maxime Chevallier
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ruoyu Wang @ 2026-06-17 19:32 UTC (permalink / raw)
To: Taras Chornyi, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Russell King, Oleksandr Mazur,
Yevhen Orlov, netdev, linux-kernel
prestera_port_sfp_bind() returns err after walking the ports node. If no
child node matches the port's front-panel id, err is never assigned.
Initialize err to 0 because absence of a matching optional port device
tree node is not an error. In that case no phylink is created and port
creation should continue with port->phy_link left NULL. Errors from
malformed matched nodes and phylink_create() still propagate.
Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
v2:
- Add net tree target to the subject.
- Explain why the no-match path returns 0 instead of -ENODEV.
drivers/net/ethernet/marvell/prestera/prestera_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
index 41e19e9ad28d4..a82e7a8029851 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
@@ -373,7 +373,7 @@ static int prestera_port_sfp_bind(struct prestera_port *port)
struct device_node *ports, *node;
struct fwnode_handle *fwnode;
struct phylink *phy_link;
- int err;
+ int err = 0;
if (!sw->np)
return 0;
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind
2026-06-17 19:32 [PATCH net v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind Ruoyu Wang
@ 2026-06-18 8:18 ` Maxime Chevallier
2026-06-18 8:55 ` [EXTERNAL] " Elad Nachman
2026-06-21 21:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Maxime Chevallier @ 2026-06-18 8:18 UTC (permalink / raw)
To: Ruoyu Wang, Taras Chornyi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King,
Oleksandr Mazur, Yevhen Orlov, netdev, linux-kernel
Hi,
On 6/17/26 21:32, Ruoyu Wang wrote:
> prestera_port_sfp_bind() returns err after walking the ports node. If no
> child node matches the port's front-panel id, err is never assigned.
>
> Initialize err to 0 because absence of a matching optional port device
> tree node is not an error. In that case no phylink is created and port
> creation should continue with port->phy_link left NULL. Errors from
> malformed matched nodes and phylink_create() still propagate.
>
> Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support")
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Sorry for the grumpiness, but Andrew did ask you to read :
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
and one of the first things it says it to wait 24h before a repost :/
The patch in itself LGTM, so :
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Please wait 24h next time,
Maxime
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [EXTERNAL] [PATCH net v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind
2026-06-17 19:32 [PATCH net v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind Ruoyu Wang
2026-06-18 8:18 ` Maxime Chevallier
@ 2026-06-18 8:55 ` Elad Nachman
2026-06-21 21:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Elad Nachman @ 2026-06-18 8:55 UTC (permalink / raw)
To: Ruoyu Wang, Taras Chornyi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King,
Oleksandr Mazur, Yevhen Orlov, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
>
>
> From: Ruoyu Wang <ruoyuw560@gmail.com>
> Sent: Wednesday, June 17, 2026 10:32 PM
> To: Taras Chornyi <taras.chornyi@plvision.eu>; Andrew Lunn <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Russell King <linux@armlinux.org.uk>; Oleksandr Mazur <oleksandr.mazur@plvision.eu>; Yevhen Orlov <yevhen.orlov@plvision.eu>; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [EXTERNAL] [PATCH net v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind
>
> prestera_port_sfp_bind() returns err after walking the ports node. If no child node matches the port's front-panel id, err is never assigned. Initialize err to 0 because absence of a matching optional port device tree node is not an error. In
>
> prestera_port_sfp_bind() returns err after walking the ports node. If no
> child node matches the port's front-panel id, err is never assigned.
>
> Initialize err to 0 because absence of a matching optional port device
> tree node is not an error. In that case no phylink is created and port
> creation should continue with port->phy_link left NULL. Errors from
> malformed matched nodes and phylink_create() still propagate.
>
> Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support")
> Signed-off-by: Ruoyu Wang <mailto:ruoyuw560@gmail.com>
> ---
> v2:
> - Add net tree target to the subject.
> - Explain why the no-match path returns 0 instead of -ENODEV.
>
> drivers/net/ethernet/marvell/prestera/prestera_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> index 41e19e9ad28d4..a82e7a8029851 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> @@ -373,7 +373,7 @@ static int prestera_port_sfp_bind(struct prestera_port *port)
> struct device_node *ports, *node;
> struct fwnode_handle *fwnode;
> struct phylink *phy_link;
> - int err;
> + int err = 0;
>
> if (!sw->np)
> return 0;
> --
> 2.51.0
>
prestera_port_sfp_bind() iterates only SFP ports.
Although all currently existing switch boards have at least one SFP uplink port,
In theory a manufacturer might produce a switch board without any SFP ports,
which will unnecessarily fail this function call, so for resolving this case indeed
err should be initialized to zero to make this function return 0 and not an error.
Acked-by: Elad Nachman <enachman@marvell.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind
2026-06-17 19:32 [PATCH net v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind Ruoyu Wang
2026-06-18 8:18 ` Maxime Chevallier
2026-06-18 8:55 ` [EXTERNAL] " Elad Nachman
@ 2026-06-21 21:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-21 21:30 UTC (permalink / raw)
To: Ruoyu Wang
Cc: taras.chornyi, andrew+netdev, davem, edumazet, kuba, pabeni,
linux, oleksandr.mazur, yevhen.orlov, netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 18 Jun 2026 03:32:28 +0800 you wrote:
> prestera_port_sfp_bind() returns err after walking the ports node. If no
> child node matches the port's front-panel id, err is never assigned.
>
> Initialize err to 0 because absence of a matching optional port device
> tree node is not an error. In that case no phylink is created and port
> creation should continue with port->phy_link left NULL. Errors from
> malformed matched nodes and phylink_create() still propagate.
>
> [...]
Here is the summary with links:
- [net,v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind
https://git.kernel.org/netdev/net/c/62b01f72d93c
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
end of thread, other threads:[~2026-06-21 21:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 19:32 [PATCH net v2] net: marvell: prestera: initialize err in prestera_port_sfp_bind Ruoyu Wang
2026-06-18 8:18 ` Maxime Chevallier
2026-06-18 8:55 ` [EXTERNAL] " Elad Nachman
2026-06-21 21:30 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.