diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2023-02-08 10:19:44 -0800 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2023-02-09 08:46:10 -0800 |
commit | d874297bc7c8bb69f9fcbe6422ac5623c5897977 (patch) | |
tree | c1600bbbe63f063eb8aaf5eb76bd01be9d3ca8b9 /drivers | |
parent | 623c0751336e4035ab0047f2c152a02bd26b612b (diff) |
cxl/mem: Correct full ID range allocation
For ID allocations we want 0-(max-1), ie: smatch complains:
error: Calling ida_alloc_range() with a 'max' argument which is a power of 2. -1 missing?
Correct this and also replace the call to use the max() flavor instead.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/20230208181944.240261-1-dave@stgolabs.net
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cxl/core/memdev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c index a74a93310d26..12bd9ddaba22 100644 --- a/drivers/cxl/core/memdev.c +++ b/drivers/cxl/core/memdev.c @@ -242,7 +242,7 @@ static struct cxl_memdev *cxl_memdev_alloc(struct cxl_dev_state *cxlds, if (!cxlmd) return ERR_PTR(-ENOMEM); - rc = ida_alloc_range(&cxl_memdev_ida, 0, CXL_MEM_MAX_DEVS, GFP_KERNEL); + rc = ida_alloc_max(&cxl_memdev_ida, CXL_MEM_MAX_DEVS - 1, GFP_KERNEL); if (rc < 0) goto err; cxlmd->id = rc; |