* [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
2026-06-18 8:55 ` [EXTERNAL] " Elad Nachman
0 siblings, 2 replies; 3+ 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] 3+ 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
1 sibling, 0 replies; 3+ 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] 3+ 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
1 sibling, 0 replies; 3+ 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] 3+ messages in thread
end of thread, other threads:[~2026-06-18 8:56 UTC | newest]
Thread overview: 3+ 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox