]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] device removal
authorPatrick Mochel <mochel@osdl.org>
Fri, 18 Oct 2002 13:53:10 +0000 (06:53 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Fri, 18 Oct 2002 13:53:10 +0000 (06:53 -0700)
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.

drivers/base/bus.c
drivers/base/core.c

index 207270822e3cdf5bc57012618680fa09f622c6d4..8d0bbb5c92563ed3d4b656616d70014c20489b14 100644 (file)
@@ -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);
 }
 
index a3ff2d8d34447801791c55038ccc3d4e07585c57..23ce66f6006336b3a27d15f472b7db3e8dce5d56 100644 (file)
@@ -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)