diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2006-11-08 22:53:59 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-01 17:36:58 -0500 |
commit | 50bf14b3ff05fb6e10688021b96f95d30a300f8d (patch) | |
tree | 0f1ffcaf0180746959ed0dee88c6153bb8ed4744 /drivers/pci/pci-driver.c | |
parent | 0dcb2b7e722f62b886f28b01150860de67d219fa (diff) |
pci: fix __pci_register_driver error handling
__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>
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r-- | drivers/pci/pci-driver.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 194f1d21d3d7..84ec9c8f6703 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -445,9 +445,12 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner) | |||
445 | 445 | ||
446 | /* register with core */ | 446 | /* register with core */ |
447 | error = driver_register(&drv->driver); | 447 | error = driver_register(&drv->driver); |
448 | if (error) | ||
449 | return error; | ||
448 | 450 | ||
449 | if (!error) | 451 | error = pci_create_newid_file(drv); |
450 | error = pci_create_newid_file(drv); | 452 | if (error) |
453 | driver_unregister(&drv->driver); | ||
451 | 454 | ||
452 | return error; | 455 | return error; |
453 | } | 456 | } |