[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230808082020.1363497-1-jiri@resnulli.us>
Date: Tue, 8 Aug 2023 10:20:20 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: kuba@...nel.org,
pabeni@...hat.com,
davem@...emloft.net,
edumazet@...gle.com
Subject: [patch net-next] devlink: clear flag on port register error path
From: Jiri Pirko <jiri@...dia.com>
When xarray insertion fails, clear the flag.
Fixes: 47b438cc2725 ("net: devlink: convert port_list into xarray")
Signed-off-by: Jiri Pirko <jiri@...dia.com>
---
net/devlink/leftover.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
index 0a9b49dfeb61..5568992a1a90 100644
--- a/net/devlink/leftover.c
+++ b/net/devlink/leftover.c
@@ -6840,8 +6840,10 @@ int devl_port_register_with_ops(struct devlink *devlink,
spin_lock_init(&devlink_port->type_lock);
INIT_LIST_HEAD(&devlink_port->reporter_list);
err = xa_insert(&devlink->ports, port_index, devlink_port, GFP_KERNEL);
- if (err)
+ if (err) {
+ devlink_port->registered = false;
return err;
+ }
INIT_DELAYED_WORK(&devlink_port->type_warn_dw, &devlink_port_type_warn);
devlink_port_type_warn_schedule(devlink_port);
--
2.41.0
Powered by blists - more mailing lists