From bb76d5869181e4c5eb84019976eed7c2c6fc0171 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 17 Dec 2007 15:26:29 -0200 Subject: bttv: check pci_register_driver() error From: Akinobu Mita Check pci_register_driver() error in module_init. Signed-off-by: Akinobu Mita Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/bt8xx/bttv-driver.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c index 3efc9465b..494afcbe6 100644 --- a/linux/drivers/media/video/bt8xx/bttv-driver.c +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c @@ -4481,7 +4481,11 @@ static int __init bttv_init_module(void) return ret; } #endif - 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) @@ -4490,7 +4494,6 @@ static void __exit bttv_cleanup_module(void) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) bus_unregister(&bttv_sub_bus_type); #endif - return; } module_init(bttv_init_module); -- cgit v1.2.3