]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
pci: fix __pci_register_driver error handling
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 9 Nov 2006 03:53:59 +0000 (19:53 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 1 Dec 2006 22:36:58 +0000 (14:36 -0800)
__pci_register_driver() error path forgot to unwind.
driver_unregister() needs to be called when pci_create_newid_file() failed.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/pci-driver.c

index 194f1d21d3d784d3ce73301acf42ff5c38240e32..84ec9c8f6703fc22e2323ff690a085d0eb810224 100644 (file)
@@ -445,9 +445,12 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner)
 
        /* register with core */
        error = driver_register(&drv->driver);
+       if (error)
+               return error;
 
-       if (!error)
-               error = pci_create_newid_file(drv);
+       error = pci_create_newid_file(drv);
+       if (error)
+               driver_unregister(&drv->driver);
 
        return error;
 }