Re: [PATCH] PCI fixes for 2.6.9

From: Greg KH
Date: Wed Oct 20 2004 - 01:02:18 EST


ChangeSet 1.1997.37.60, 2004/10/06 14:07:29-07:00, greg@xxxxxxxxx

[PATCH] PCI: fix up pci_register_driver() to stop lying in its return value.

It shouldn't return 1, it needs to return either -ERROR or 0.

Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>


drivers/pci/pci-driver.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)


diff -Nru a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
--- a/drivers/pci/pci-driver.c 2004-10-19 15:22:08 -07:00
+++ b/drivers/pci/pci-driver.c 2004-10-19 15:22:08 -07:00
@@ -396,13 +396,13 @@
* @drv: the driver structure to register
*
* Adds the driver structure to the list of registered drivers.
- * Returns a negative value on error. The driver remains registered
- * even if no device was claimed during registration.
+ * Returns a negative value on error, otherwise 0.
+ * If no error occured, the driver remains registered even if
+ * no device was claimed during registration.
*/
-int
-pci_register_driver(struct pci_driver *drv)
+int pci_register_driver(struct pci_driver *drv)
{
- int count = 0;
+ int error;

/* initialize common driver fields */
drv->driver.name = drv->name;
@@ -413,13 +413,12 @@
pci_init_dynids(&drv->dynids);

/* register with core */
- count = driver_register(&drv->driver);
+ error = driver_register(&drv->driver);

- if (count >= 0) {
+ if (!error)
pci_populate_driver_dir(drv);
- }

- return count ? count : 1;
+ return error;
}

/**

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/