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>
This commit is contained in:
Akinobu Mita 2006-11-08 19:53:59 -08:00 committed by Greg Kroah-Hartman
parent 0dcb2b7e72
commit 50bf14b3ff
1 changed files with 5 additions and 2 deletions

View 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;
}