From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: <dan.j.williams@intel.com>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH] cxl/mem: Correct full ID range allocation
Date: Thu, 9 Feb 2023 15:45:18 +0000 [thread overview]
Message-ID: <20230209154518.000011a7@Huawei.com> (raw)
In-Reply-To: <20230208181944.240261-1-dave@stgolabs.net>
On Wed, 8 Feb 2023 10:19:44 -0800
Davidlohr Bueso <dave@stgolabs.net> wrote:
> 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>
I'm not sure I follow the smatch error always applying, but definitely suspicious here
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> drivers/cxl/core/memdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
next prev parent reply other threads:[~2023-02-09 16:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 18:19 [PATCH] cxl/mem: Correct full ID range allocation Davidlohr Bueso
2023-02-08 23:50 ` Dave Jiang
2023-02-09 15:45 ` Jonathan Cameron [this message]
2023-02-09 17:03 ` Davidlohr Bueso
2023-02-09 16:44 ` Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230209154518.000011a7@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=dan.j.williams@intel.com \
--cc=dave@stgolabs.net \
--cc=linux-cxl@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.