Re: [PATCH 2/2] qlcnic: move notifier error cleanup under CONFIG_INET

From: Jacob Keller

Date: Wed Jul 29 2026 - 19:43:16 EST


On 7/27/2026 8:20 PM, Can Peng wrote:
> 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@xxxxxxxxxx>
> ---
> 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;
> }

Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>