From: Akinobu Mita Date: Thu, 9 Nov 2006 03:53:59 +0000 (-0800) Subject: pci: fix __pci_register_driver error handling X-Git-Tag: v2.6.20-rc2~6^2~13^2~478^2~13 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=50bf14b3ff05fb6e10688021b96f95d30a300f8d;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 194f1d21d3d..84ec9c8f670 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) /* 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; }