summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorRussell King <rmk+lkml@arm.linux.org.uk>2004-01-28 22:26:16 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-01-28 22:26:16 -0800
commitb5849a353834172c4e11b494aa5df5c7bd37bd55 (patch)
treef5f63686f4fdd784b642239d0495def3ba471348 /include/linux
parent0dc316dee192a2e178d52b2a2324fbe18ed46f1c (diff)
[PATCH] Prevent PCI driver registration failure oopsing
Greg, As discussed about six or so months ago, we agreed to hold off this patch until fairly late, due to its ability to catch duplicate PCI driver names. Please note that I haven't attempted to reproduce the problem with recent kernels, and that all ARM kernel patches released since then have had this patch in. I'm guessing this will actually be 2.6.1 material since it probably doesn't show for PCI drivers which are part of the kernel tree. If pci_register_driver fails, the register the PCI driver structure will not be registered with the driver model. pci_register_driver returns with negative value, and we then attempt to unregister the driver structure. This leads to an oops in the driver model. The driver model does not return the number of devices it successfully bound the driver to, and neither does pci_register_driver() return this information. Therefore, all of the code below is redundant. (There's a little redundancy left in drivers/pci/pci-driver.c but it is harmless unlike this block.)
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pci.h21
1 files changed, 1 insertions, 20 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index b88b9d3f5bfc..d6a87a2eb263 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -785,26 +785,7 @@ static inline int pci_module_init(struct pci_driver *drv)
{
int rc = pci_register_driver (drv);
- if (rc > 0)
- return 0;
-
- /* iff CONFIG_HOTPLUG and built into kernel, we should
- * leave the driver around for future hotplug events.
- * For the module case, a hotplug daemon of some sort
- * should load a module in response to an insert event. */
-#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
- if (rc == 0)
- return 0;
-#else
- if (rc == 0)
- rc = -ENODEV;
-#endif
-
- /* if we get here, we need to clean up pci driver instance
- * and return some sort of error */
- pci_unregister_driver (drv);
-
- return rc;
+ return rc < 0 ? rc : 0;
}
/*