V4L/DVB (6848): bttv: check pci_register_driver() error
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 17 Dec 2007 17:26:29 +0000 (14:26 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:03:57 +0000 (19:03 -0200)
Check pci_register_driver() error in module_init.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/bt8xx/bttv-driver.c

index eb2c12eb2fc884a828e08cf7d7cd66910876cdc2..e04113f0b7e27d0c4333d92bc371941f0c46a6ee 100644 (file)
@@ -4404,14 +4404,17 @@ static int __init bttv_init_module(void)
                printk(KERN_WARNING "bttv: bus_register error: %d\n", ret);
                return ret;
        }
-       return pci_register_driver(&bttv_pci_driver);
+       ret = pci_register_driver(&bttv_pci_driver);
+       if (ret < 0)
+               bus_unregister(&bttv_sub_bus_type);
+
+       return ret;
 }
 
 static void __exit bttv_cleanup_module(void)
 {
        pci_unregister_driver(&bttv_pci_driver);
        bus_unregister(&bttv_sub_bus_type);
-       return;
 }
 
 module_init(bttv_init_module);