Re: [PATCH 16/26] dmaengine: Convert to new IDA API

From: Matthew Wilcox
Date: Tue Jun 26 2018 - 19:01:03 EST


On Sun, Jun 24, 2018 at 09:57:45AM +0200, Lars-Peter Clausen wrote:
> > + int rc = ida_alloc(&dma_ida, GFP_KERNEL);
> >
> > + if (rc >= 0)
> > + device->dev_id = rc;
> > return rc;
>
> This used to return 0 on success, now it returns the ID. That wont work
> considering that it is used like this
>
> rc = get_dma_id(device);
> if (rc != 0) ...

Thanks! I changed it to this:

static int get_dma_id(struct dma_device *device)
{
int rc = ida_alloc(&dma_ida, GFP_KERNEL);

if (rc < 0)
return rc;
device->dev_id = rc;
return 0;
}