Re: [PATCH 13/62] firewire: convert to idr_alloc()

From: Stefan Richter
Date: Sun Feb 03 2013 - 06:18:51 EST


On Feb 03 Stefan Richter wrote:
> On Feb 02 Tejun Heo wrote:
> > --- a/drivers/firewire/core-device.c
> > +++ b/drivers/firewire/core-device.c
> > @@ -1017,13 +1017,12 @@ 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;
> > + ret = idr_alloc(&fw_device_idr, device, 0, 0, GFP_KERNEL);
> > up_write(&fw_device_rwsem);
> >
> > if (ret < 0)
> > goto error;
> > + minor = ret;
> >
> > device->device.bus = &fw_bus_type;
> > device->device.type = &fw_device_type;
>
> This hunk is OK, of course.

Could be changed into

ret = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS, GFP_KERNEL);

though, which would be an additional bug fix.
--
Stefan Richter
-=====-===-= --=- ---==
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/