* [PATCH net-next v2] net: cpsw_new: unregister devlink on port registration failure
@ 2026-06-04 4:31 Guangshuo Li
2026-06-06 0:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-06-04 4:31 UTC (permalink / raw)
To: Siddharth Vadapalli, Roger Quadros, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexander Sverdlin,
Kevin Hao, Aleksandr Loktionov, Daniel Zahka, Guangshuo Li,
linux-omap, netdev, linux-kernel
Cc: Alexander Sverdlin
cpsw_probe() registers devlink before registering the CPSW ports.
If cpsw_register_ports() fails, the error path only unregisters the
notifiers and then releases the lower level resources. It does not undo
the successful cpsw_register_devlink() call, leaving the devlink instance
and its parameters registered after probe has failed.
Add a devlink cleanup label for the path where devlink registration has
already succeeded, and use it when port registration fails.
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
v2:
- Updated the subject for net-next.
- Dropped the Fixes tag.
drivers/net/ethernet/ti/cpsw_new.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
index 7f42f58a4b03..95b3b58db6e0 100644
--- a/drivers/net/ethernet/ti/cpsw_new.c
+++ b/drivers/net/ethernet/ti/cpsw_new.c
@@ -2050,7 +2050,7 @@ static int cpsw_probe(struct platform_device *pdev)
ret = cpsw_register_ports(cpsw);
if (ret)
- goto clean_unregister_notifiers;
+ goto clean_unregister_devlink;
dev_notice(dev, "initialized (regs %pa, pool size %d) hw_ver:%08X %d.%d (%d)\n",
&ss_res->start, descs_pool_size,
@@ -2062,6 +2062,8 @@ static int cpsw_probe(struct platform_device *pdev)
return 0;
+clean_unregister_devlink:
+ cpsw_unregister_devlink(cpsw);
clean_unregister_notifiers:
cpsw_unregister_notifiers(cpsw);
clean_cpts:
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net-next v2] net: cpsw_new: unregister devlink on port registration failure
2026-06-04 4:31 [PATCH net-next v2] net: cpsw_new: unregister devlink on port registration failure Guangshuo Li
@ 2026-06-06 0:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-06 0:40 UTC (permalink / raw)
To: Guangshuo Li
Cc: s-vadapalli, rogerq, andrew+netdev, davem, edumazet, kuba,
pabeni, alexander.sverdlin, haokexin, aleksandr.loktionov,
daniel.zahka, linux-omap, netdev, linux-kernel,
alexander.sverdlin
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 4 Jun 2026 12:31:15 +0800 you wrote:
> cpsw_probe() registers devlink before registering the CPSW ports.
>
> If cpsw_register_ports() fails, the error path only unregisters the
> notifiers and then releases the lower level resources. It does not undo
> the successful cpsw_register_devlink() call, leaving the devlink instance
> and its parameters registered after probe has failed.
>
> [...]
Here is the summary with links:
- [net-next,v2] net: cpsw_new: unregister devlink on port registration failure
https://git.kernel.org/netdev/net-next/c/b64f763b6074
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] 2+ messages in thread
end of thread, other threads:[~2026-06-06 0:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-04 4:31 [PATCH net-next v2] net: cpsw_new: unregister devlink on port registration failure Guangshuo Li
2026-06-06 0:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®