qlcnic: fix netdev notifier in error path

netdev notifier are not unregistered if pci_register_driver fails.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Amit Kumar Salecha 2010-07-13 20:33:33 +00:00 committed by David S. Miller
parent 0df170b607
commit 0cf3a14cb2
1 changed files with 9 additions and 1 deletions

View File

@ -3451,6 +3451,7 @@ static struct pci_driver qlcnic_driver = {
static int __init qlcnic_init_module(void) static int __init qlcnic_init_module(void)
{ {
int ret;
printk(KERN_INFO "%s\n", qlcnic_driver_string); printk(KERN_INFO "%s\n", qlcnic_driver_string);
@ -3459,8 +3460,15 @@ static int __init qlcnic_init_module(void)
register_inetaddr_notifier(&qlcnic_inetaddr_cb); register_inetaddr_notifier(&qlcnic_inetaddr_cb);
#endif #endif
ret = pci_register_driver(&qlcnic_driver);
if (ret) {
#ifdef CONFIG_INET
unregister_inetaddr_notifier(&qlcnic_inetaddr_cb);
unregister_netdevice_notifier(&qlcnic_netdev_cb);
#endif
}
return pci_register_driver(&qlcnic_driver); return ret;
} }
module_init(qlcnic_init_module); module_init(qlcnic_init_module);