mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Can Peng <pengcan@kylinos.cn>
To: manishc@marvell.com, rahulv@marvell.com,
	GR-Linux-NIC-Dev@marvell.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Can Peng <pengcan@kylinos.cn>
Subject: [PATCH 2/2] qlcnic: move notifier error cleanup under CONFIG_INET
Date: Tue, 28 Jul 2026 11:20:46 +0800	[thread overview]
Message-ID: <20260728032046.121631-3-pengcan@kylinos.cn> (raw)
In-Reply-To: <20260728032046.121631-1-pengcan@kylinos.cn>

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


  parent reply	other threads:[~2026-07-28  3:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-29 23:06   ` Jacob Keller
2026-07-28  3:20 ` Can Peng [this message]
2026-07-29 23:38   ` [PATCH 2/2] qlcnic: move notifier error cleanup under CONFIG_INET Jacob Keller
2026-08-03 23:22   ` Jakub Kicinski
2026-08-03 23:30 ` [PATCH 0/2] qlogic: fix and tidy notifier cleanup paths patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260728032046.121631-3-pengcan@kylinos.cn \
    --to=pengcan@kylinos.cn \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rahulv@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®