Re: [PATCH v2 2/3] iommu/sva: Stop using ioasid_set for SVA

From: Jean-Philippe Brucker
Date: Fri Feb 24 2023 - 12:44:38 EST


On Wed, Feb 15, 2023 at 01:36:51PM -0800, Jacob Pan wrote:
> > > - pasid = ioasid_alloc(&iommu_sva_pasid, min, max, mm);
> > > - if (!pasid_valid(pasid))
> > > - ret = -ENOMEM;
> > > - else
> > > - mm_pasid_set(mm, pasid);
> > > + ret = ida_alloc_range(&iommu_global_pasid_ida, min, max,
> > > GFP_KERNEL);
> > > + if (ret < min)
> >
> > Just check ret < 0
> yes, but i thought < min is safe too.

It is, but 'ret < 0' is the standard used everywhere else. So someone
reading this code will stop and spend time trying to figure out why this
isn't 'ret < 0', wonder what's special here, inspect the ida_alloc_range()
doc, etc. No big deal, but I think it's unnecessary.

Thanks,
Jean