Skip to contentSkip to conversation

net: devlink: add WARN_ON_ONCE to check return value of unregister_netdevice_notifier_net() call

PATCH Applied Jiri Pirko 3 participants 3 messages Nov 25, 2022 – Nov 29, 2022

Subsystems (2)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 net: devlink: add WARN_ON_ONCE to check return value of unregister_netdevice_notifier_net() call

From: Jiri Pirko <[email protected]>

As the return value is not 0 only in case there is no such notifier block registered, add a WARN_ON_ONCE() to yell about it.

---
 net/core/devlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/devlink.c +2 -2
index cea154ddce7a..0e10a8a68c5e 100644
@@ -9907,8 +9907,8 @@ void devlink_free(struct devlink *devlink)
 
 	xa_destroy(&devlink->snapshot_ids);
 
-	unregister_netdevice_notifier_net(devlink_net(devlink),
-					  &devlink->netdevice_nb);
+	WARN_ON_ONCE(unregister_netdevice_notifier_net(devlink_net(devlink),
+						       &devlink->netdevice_nb));
 
 	xa_erase(&devlinks, devlink->index);
 
Signature · 1 line
2.37.3
#2 lore raw
In reply to Jiri Pirko
This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Fri, 25 Nov 2022 11:02:55 +0100 you wrote:

From: Jiri Pirko <[email protected]>

As the return value is not 0 only in case there is no such notifier block registered, add a WARN_ON_ONCE() to yell about it.

[...]

Here is the summary with links:
- [net-next] net: devlink: add WARN_ON_ONCE to check return value of unregister_netdevice_notifier_net() call

    https://git.kernel.org/netdev/net-next/c/7666dbec7268

You are awesome, thank you!

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