]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: marvell: prestera: initialize err in prestera_port_sfp_bind
authorRuoyu Wang <ruoyuw560@gmail.com>
Wed, 17 Jun 2026 19:32:28 +0000 (03:32 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sun, 21 Jun 2026 21:23:53 +0000 (14:23 -0700)
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>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Acked-by: Elad Nachman <enachman@marvell.com>
Link: https://patch.msgid.link/20260617193228.1653582-1-ruoyuw560@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/prestera/prestera_main.c

index 41e19e9ad28d41f9f3a84f77d346df04b0151160..a82e7a80298513328113680f0f65ce07253be198 100644 (file)
@@ -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;