[PATCH 2/7] driver core: safely unbind drivers for devices not on a bus

From: Greg KH
Date: Fri Apr 14 2006 - 16:12:42 EST


This patch (as667) changes the __device_release_driver() routine to
prevent it from crashing when it runs across a device not on any bus.
This seems logical, inasmuch as the corresponding bus_add_device()
routine has an explicit check allowing it to accept such devices.

Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---

drivers/base/dd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

0f836ca4c122f4ef096110d652a6326fe34e6961
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 730a9ce..889c711 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -209,7 +209,7 @@ static void __device_release_driver(stru
sysfs_remove_link(&dev->kobj, "driver");
klist_remove(&dev->knode_driver);

- if (dev->bus->remove)
+ if (dev->bus && dev->bus->remove)
dev->bus->remove(dev);
else if (drv->remove)
drv->remove(dev);
--
1.2.6


-
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/