]> git.baikalelectronics.ru Git - kernel.git/commitdiff
bnx2x: free workqueue when driver fail to register
authorStanislaw Gruszka <sgruszka@redhat.com>
Tue, 5 May 2009 23:22:01 +0000 (23:22 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 May 2009 21:52:03 +0000 (14:52 -0700)
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bnx2x_main.c

index a669bb7eb00c2e26297a6675fa096b856cb7b6c4..519e2079f03a3c344f86b4c5287678fcc9b2198f 100644 (file)
@@ -11630,13 +11630,20 @@ static struct pci_driver bnx2x_pci_driver = {
 
 static int __init bnx2x_init(void)
 {
+       int ret;
+
        bnx2x_wq = create_singlethread_workqueue("bnx2x");
        if (bnx2x_wq == NULL) {
                printk(KERN_ERR PFX "Cannot create workqueue\n");
                return -ENOMEM;
        }
 
-       return pci_register_driver(&bnx2x_pci_driver);
+       ret = pci_register_driver(&bnx2x_pci_driver);
+       if (ret) {
+               printk(KERN_ERR PFX "Cannot register driver\n");
+               destroy_workqueue(bnx2x_wq);
+       }
+       return ret;
 }
 
 static void __exit bnx2x_cleanup(void)