]> Pileus Git - ~andy/linux/blobdiff - drivers/firewire/core-device.c
firewire: convert to idr_alloc()
[~andy/linux] / drivers / firewire / core-device.c
index af3e8aa5eedc90b90bf572a222536100987c77cc..03ce7d980c6ac4d83015e83731d032d778d482aa 100644 (file)
@@ -1017,16 +1017,11 @@ static void fw_device_init(struct work_struct *work)
 
        fw_device_get(device);
        down_write(&fw_device_rwsem);
-       ret = idr_pre_get(&fw_device_idr, GFP_KERNEL) ?
-             idr_get_new(&fw_device_idr, device, &minor) :
-             -ENOMEM;
-       if (minor >= 1 << MINORBITS) {
-               idr_remove(&fw_device_idr, minor);
-               minor = -ENOSPC;
-       }
+       minor = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS,
+                       GFP_KERNEL);
        up_write(&fw_device_rwsem);
 
-       if (ret < 0)
+       if (minor < 0)
                goto error;
 
        device->device.bus = &fw_bus_type;