decl_subsys(bus, &ktype_bus, NULL);
 
 
-/* Manually detach a device from it's associated driver. */
+/* Manually detach a device from its associated driver. */
 static int driver_helper(struct device *dev, void *data)
 {
        const char *name = data;
        int err = -ENODEV;
 
        dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
-       if ((dev) &&
-           (dev->driver == drv)) {
+       if (dev && dev->driver == drv) {
                device_release_driver(dev);
                err = count;
        }
-       if (err)
-               return err;
-       return count;
+       put_device(dev);
+       put_bus(bus);
+       return err;
 }
 static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);
 
        int err = -ENODEV;
 
        dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
-       if ((dev) &&
-           (dev->driver == NULL)) {
+       if (dev && dev->driver == NULL) {
                down(&dev->sem);
                err = driver_probe_device(drv, dev);
                up(&dev->sem);
-               put_device(dev);
        }
-       if (err)
-               return err;
-       return count;
+       put_device(dev);
+       put_bus(bus);
+       return err;
 }
 static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
 
 
  *     because we don't know the format of the ID structures, nor what
  *     is to be considered a match and what is not.
  *
- *
  *     This function returns 1 if a match is found, an error if one
  *     occurs (that is not -ENODEV or -ENXIO), and 0 otherwise.
  *
                driver_probe_device(drv, dev);
        up(&dev->sem);
 
-
        return 0;
 }
 
        struct device * dev;
 
        for (;;) {
-               spin_lock_irq(&drv->klist_devices.k_lock);
+               spin_lock(&drv->klist_devices.k_lock);
                if (list_empty(&drv->klist_devices.k_list)) {
-                       spin_unlock_irq(&drv->klist_devices.k_lock);
+                       spin_unlock(&drv->klist_devices.k_lock);
                        break;
                }
                dev = list_entry(drv->klist_devices.k_list.prev,
                                struct device, knode_driver.n_node);
                get_device(dev);
-               spin_unlock_irq(&drv->klist_devices.k_lock);
+               spin_unlock(&drv->klist_devices.k_lock);
 
                down(&dev->sem);
                if (dev->driver == drv)