Skip to content

Commit

Permalink
pci: fix __pci_register_driver error handling
Browse files Browse the repository at this point in the history
__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>
  • Loading branch information
Akinobu Mita authored and Greg Kroah-Hartman committed Dec 1, 2006
1 parent 0dcb2b7 commit 50bf14b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 50bf14b

Please sign in to comment.