Skip to contentSkip to conversation

net: sparx5: unregister blocking notifier on init failure

PATCH Applied Haoxiang Li 3 participants 3 messages Jun 23 – Jun 25

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sparx5: unregister blocking notifier on init failure

sparx5_register_notifier_blocks() registers the switchdev blocking notifier before allocating the ordered workqueue. If the workqueue allocation fails, the error path unregisters the switchdev and netdevice notifiers, but leaves the blocking notifier registered.

Add a separate error label for the workqueue allocation failure path and unregister the switchdev blocking notifier there.

Fixes d6fce5141929 ("net: sparx5: add switching support")
---
 drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c +3 -1
index 644458108dd2..dac4dd833127 100644
@@ -765,11 +765,13 @@ int sparx5_register_notifier_blocks(struct sparx5 *s5)
 	sparx5_owq = alloc_ordered_workqueue("sparx5_order", 0);
 	if (!sparx5_owq) {
 		err = -ENOMEM;
-		goto err_switchdev_blocking_nb;
+		goto err_alloc_workqueue;
 	}
 
 	return 0;
 
+err_alloc_workqueue:
+	unregister_switchdev_blocking_notifier(&s5->switchdev_blocking_nb);
 err_switchdev_blocking_nb:
 	unregister_switchdev_notifier(&s5->switchdev_nb);
 err_switchdev_nb:
Signature · 1 line
2.25.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Haoxiang Li

sparx5_register_notifier_blocks() registers the switchdev blocking notifier before allocating the ordered workqueue. If the workqueue allocation fails, the error path unregisters the switchdev and netdevice notifiers, but leaves the blocking notifier registered.

Add a separate error label for the workqueue allocation failure path and unregister the switchdev blocking notifier there.

Fixes d6fce5141929 ("net: sparx5: add switching support")
#2 lore raw
In reply to Haoxiang Li
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Tue, 23 Jun 2026 19:57:14 +0800 you wrote:

sparx5_register_notifier_blocks() registers the switchdev blocking notifier before allocating the ordered workqueue. If the workqueue allocation fails, the error path unregisters the switchdev and netdevice notifiers, but leaves the blocking notifier registered.

Add a separate error label for the workqueue allocation failure path and unregister the switchdev blocking notifier there.

[...]

Here is the summary with links:
- net: sparx5: unregister blocking notifier on init failure

    https://git.kernel.org/netdev/net/c/483be61b4a9a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html