linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: lars@metafoo.de, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] iio: buffer: Save a few cycles in 'iio_scan_mask_set()'
Date: Sat, 17 Jul 2021 17:58:32 +0100	[thread overview]
Message-ID: <20210717175832.2f3f8116@jic23-huawei> (raw)
In-Reply-To: <89d8a766eb971eda1ee362444a8711037bdb208c.1626261211.git.christophe.jaillet@wanadoo.fr>

On Wed, 14 Jul 2021 13:14:41 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> Use 'bitmap_alloc()' instead of 'bitmap_zalloc()' because the bitmap
> is fully overridden by a 'bitmap_copy()' call just after its allocation.
> 
> While at it, fix the style of a NULL check.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders
to poke at it.

Thanks,

Jonathan

> ---
>  drivers/iio/industrialio-buffer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index fdd623407b96..6d4776a7f002 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -354,8 +354,8 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
>  	const unsigned long *mask;
>  	unsigned long *trialmask;
>  
> -	trialmask = bitmap_zalloc(indio_dev->masklength, GFP_KERNEL);
> -	if (trialmask == NULL)
> +	trialmask = bitmap_alloc(indio_dev->masklength, GFP_KERNEL);
> +	if (!trialmask)
>  		return -ENOMEM;
>  	if (!indio_dev->masklength) {
>  		WARN(1, "Trying to set scanmask prior to registering buffer\n");


      parent reply	other threads:[~2021-07-17 16:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 11:14 [PATCH 1/2] iio: buffer: Save a few cycles in 'iio_scan_mask_set()' Christophe JAILLET
2021-07-14 11:14 ` [PATCH 2/2] iio: buffer: Move a sanity check at the beginning of 'iio_scan_mask_set()' Christophe JAILLET
2021-07-17 16:59   ` Jonathan Cameron
2021-07-17 16:58 ` Jonathan Cameron [this message]

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=20210717175832.2f3f8116@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).