Netdev List
 help / color / mirror / Atom feed
* [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

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