* [PATCH 0/2] qlogic: fix and tidy notifier cleanup paths
@ 2026-07-28 3:20 Can Peng
2026-07-28 3:20 ` [PATCH 1/2] netxen: unregister notifiers if PCI registration fails Can Peng
2026-07-28 3:20 ` [PATCH 2/2] qlcnic: move notifier error cleanup under CONFIG_INET Can Peng
0 siblings, 2 replies; 3+ messages in thread
From: Can Peng @ 2026-07-28 3:20 UTC (permalink / raw)
To: manishc, rahulv, GR-Linux-NIC-Dev, andrew+netdev, davem, edumazet,
kuba, pabeni
Cc: netdev, linux-kernel, Can Peng
Hi,
This series fixes and tidies notifier cleanup in the qlogic Ethernet
drivers.
Patch 1 fixes netxen by unregistering the netdevice and inetaddr
notifiers if pci_register_driver() fails. Without this, module init can
return an error while leaving callbacks registered for a module that did
not load successfully.
Patch 2 keeps qlcnic's existing notifier cleanup error path under the
same CONFIG_INET guard as the notifier registration, avoiding an empty
if statement when CONFIG_INET is disabled.
Can Peng (2):
netxen: unregister notifiers if PCI registration fails
qlcnic: move notifier error cleanup under CONFIG_INET
.../net/ethernet/qlogic/netxen/netxen_nic_main.c | 13 ++++++++++++-
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 4 ++--
2 files changed, 14 insertions(+), 3 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] netxen: unregister notifiers if PCI registration fails
2026-07-28 3:20 [PATCH 0/2] qlogic: fix and tidy notifier cleanup paths Can Peng
@ 2026-07-28 3:20 ` Can Peng
2026-07-28 3:20 ` [PATCH 2/2] qlcnic: move notifier error cleanup under CONFIG_INET Can Peng
1 sibling, 0 replies; 3+ messages in thread
From: Can Peng @ 2026-07-28 3:20 UTC (permalink / raw)
To: manishc, rahulv, GR-Linux-NIC-Dev, andrew+netdev, davem, edumazet,
kuba, pabeni
Cc: netdev, linux-kernel, Can Peng
netxen_init_module() registers the netdevice and inetaddr notifiers before
registering the PCI driver. If pci_register_driver() fails, the function
returns the error directly and leaves both notifiers registered.
That leaves notifier callbacks installed for a module that failed to load.
Mirror the module exit path on this failure and unregister the notifiers
before returning the error.
Fixes: 6598b169b856 ("netxen: enable ip addr hashing")
Signed-off-by: Can Peng <pengcan@kylinos.cn>
---
.../net/ethernet/qlogic/netxen/netxen_nic_main.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 5ee2bd9d6886..67d9bf69f8f2 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -3447,13 +3447,24 @@ static struct pci_driver netxen_driver = {
static int __init netxen_init_module(void)
{
+ int ret;
+
printk(KERN_INFO "%s\n", netxen_nic_driver_string);
#ifdef CONFIG_INET
register_netdevice_notifier(&netxen_netdev_cb);
register_inetaddr_notifier(&netxen_inetaddr_cb);
#endif
- return pci_register_driver(&netxen_driver);
+
+ ret = pci_register_driver(&netxen_driver);
+#ifdef CONFIG_INET
+ if (ret) {
+ unregister_inetaddr_notifier(&netxen_inetaddr_cb);
+ unregister_netdevice_notifier(&netxen_netdev_cb);
+ }
+#endif
+
+ return ret;
}
module_init(netxen_init_module);
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] qlcnic: move notifier error cleanup under CONFIG_INET
2026-07-28 3:20 [PATCH 0/2] qlogic: fix and tidy notifier cleanup paths Can Peng
2026-07-28 3:20 ` [PATCH 1/2] netxen: unregister notifiers if PCI registration fails Can Peng
@ 2026-07-28 3:20 ` Can Peng
1 sibling, 0 replies; 3+ messages in thread
From: Can Peng @ 2026-07-28 3:20 UTC (permalink / raw)
To: manishc, rahulv, GR-Linux-NIC-Dev, andrew+netdev, davem, edumazet,
kuba, pabeni
Cc: netdev, linux-kernel, Can Peng
qlcnic_init_module() registers the netdevice and inetaddr notifiers only
when CONFIG_INET is enabled, but the pci_register_driver() error handling
block is outside that guard.
Move the error check under CONFIG_INET together with the cleanup it
protects. This avoids an empty if statement when CONFIG_INET is disabled
and keeps the cleanup code structured like the guarded registration path.
Signed-off-by: Can Peng <pengcan@kylinos.cn>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index ff4f7cd20c79..46d07faa24fd 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -4221,12 +4221,12 @@ static int __init qlcnic_init_module(void)
#endif
ret = pci_register_driver(&qlcnic_driver);
- if (ret) {
#ifdef CONFIG_INET
+ if (ret) {
unregister_inetaddr_notifier(&qlcnic_inetaddr_cb);
unregister_netdevice_notifier(&qlcnic_netdev_cb);
-#endif
}
+#endif
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-28 3:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 3:20 [PATCH 0/2] qlogic: fix and tidy notifier cleanup paths Can Peng
2026-07-28 3:20 ` [PATCH 1/2] netxen: unregister notifiers if PCI registration fails Can Peng
2026-07-28 3:20 ` [PATCH 2/2] qlcnic: move notifier error cleanup under CONFIG_INET Can Peng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox