* [PATCH] pci: fix __pci_register_driver error handling
@ 2006-10-28 18:40 Akinobu Mita
0 siblings, 0 replies; only message in thread
From: Akinobu Mita @ 2006-10-28 18:40 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Kroah-Hartman
__pci_register_driver() error path forgot to unwind.
driver_unregister() needs to be called when pci_create_newid_file() failed.
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
drivers/pci/pci-driver.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: work-fault-inject/drivers/pci/pci-driver.c
===================================================================
--- work-fault-inject.orig/drivers/pci/pci-driver.c
+++ work-fault-inject/drivers/pci/pci-driver.c
@@ -445,9 +445,12 @@ int __pci_register_driver(struct pci_dri
/* 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-10-28 18:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-28 18:40 [PATCH] pci: fix __pci_register_driver error handling Akinobu Mita
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox