[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20061028184042.GB9973@localhost>
Date: Sun, 29 Oct 2006 03:40:42 +0900
From: Akinobu Mita <akinobu.mita@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...e.de>
Subject: [PATCH] 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.
Cc: Greg Kroah-Hartman <gregkh@...e.de>
Signed-off-by: Akinobu Mita <akinobu.mita@...il.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;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists