Skip to content

Commit

Permalink
[PATCH] driver core: safely unbind drivers for devices not on a bus
Browse files Browse the repository at this point in the history
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@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Apr 14, 2006
1 parent 4508a7a commit 0f836ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static void __device_release_driver(struct device * dev)
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);
Expand Down

0 comments on commit 0f836ca

Please sign in to comment.