Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mochel <mochel@osdl.org>2002-10-18 06:53:10 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-10-18 06:53:10 -0700
commita49c4f6a503a00fecba297858cc02010fdb7f53d (patch)
tree4bd9b7cdf665d8c2413e6e7061d98f2e7afbd25d
parent441a964bd1c531d3ab88b9efde1ed4dfcbc9d371 (diff)
[PATCH] device removal
The problem was that when the refcount hit 0, it was unconditionally assuming that it had been added, which is wrong. The patch below corrects that, and fixes the Oops when loading the floppy driver.
-rw-r--r--drivers/base/bus.c2
-rw-r--r--drivers/base/core.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 207270822e3c..8d0bbb5c9256 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -274,7 +274,7 @@ void put_bus(struct bus_type * bus)
return;
list_del_init(&bus->node);
spin_unlock(&device_lock);
- BUG_ON(bus->present);
+ WARN_ON(bus->present);
bus_remove_dir(bus);
}
diff --git a/drivers/base/core.c b/drivers/base/core.c
index a3ff2d8d3444..23ce66f60063 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -136,9 +136,10 @@ void put_device(struct device * dev)
list_del_init(&dev->g_list);
up(&device_sem);
- WARN_ON(dev->state != DEVICE_GONE);
+ WARN_ON(dev->state == DEVICE_REGISTERED);
- device_del(dev);
+ if (dev->state == DEVICE_GONE)
+ device_del(dev);
}
void device_del(struct device * dev)