summaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-10-05 23:03:24 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-10-18 21:49:55 +0200
commitf70fa6296c2ec8f541f0a9b406ccc2d9d127d639 (patch)
treef9fd9bbb13a62683c6b41612cfb34fa3894f8676 /drivers/base/bus.c
parentDriver core: Don't leak 'old_class_name' in drivers/base/core.c::device_rename() (diff)
downloadlinux-f70fa6296c2ec8f541f0a9b406ccc2d9d127d639.tar.xz
linux-f70fa6296c2ec8f541f0a9b406ccc2d9d127d639.zip
Driver core: Don't ignore error returns from probing
This patch (as797) fixes device_add() in the driver core. It needs to pay attention when the driver for a new device reports an error. At the same time, since bus_remove_device() undoes the effects of both bus_add_device() and bus_attach_device(), it needs to check whether the bus_attach_device step failed. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index d516f7d5f168..d7c5ea246a0b 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -439,8 +439,10 @@ void bus_remove_device(struct device * dev)
sysfs_remove_link(&dev->kobj, "bus");
sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
device_remove_attrs(dev->bus, dev);
- dev->is_registered = 0;
- klist_del(&dev->knode_bus);
+ if (dev->is_registered) {
+ dev->is_registered = 0;
+ klist_del(&dev->knode_bus);
+ }
pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
device_release_driver(dev);
put_bus(dev->bus);