From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, yury.norov@gmail.com
Subject: Re: [PATCH v1] lib/bitmap: Convert infinite while loop to for one
Date: Tue, 9 Jun 2020 16:23:16 +0200 [thread overview]
Message-ID: <20200609142316.GA7558@oc3871087118.ibm.com> (raw)
In-Reply-To: <20200609140535.87160-1-andriy.shevchenko@linux.intel.com>
On Tue, Jun 09, 2020 at 05:05:35PM +0300, Andy Shevchenko wrote:
> Convert infinite while loop to for one in order to be more explicit
> in one place what we are doing with chunks.
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>
> Andrew, this can be folded to the fix
>
> lib/bitmap.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/lib/bitmap.c b/lib/bitmap.c
> index 10f8fa0497e3..03ef42fbe658 100644
> --- a/lib/bitmap.c
> +++ b/lib/bitmap.c
> @@ -740,10 +740,10 @@ int bitmap_parse(const char *start, unsigned int buflen,
> const char *end = strnchrnul(start, buflen, '\n') - 1;
> int chunks = BITS_TO_U32(nmaskbits);
> u32 *bitmap = (u32 *)maskp;
> - int chunk = 0;
> int unset_bit;
> + int chunk;
>
> - while (1) {
> + for (chunk = 0; ; chunk++) {
> end = bitmap_find_region_reverse(start, end);
> if (start > end)
> break;
> @@ -758,7 +758,6 @@ int bitmap_parse(const char *start, unsigned int buflen,
> #endif
> if (IS_ERR(end))
> return PTR_ERR(end);
> - chunk++;
> }
>
> unset_bit = (BITS_TO_U32(nmaskbits) - chunks) * 32;
> --
> 2.27.0.rc2
>
prev parent reply other threads:[~2020-06-09 14:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 14:05 Andy Shevchenko
2020-06-09 14:23 ` Alexander Gordeev [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=20200609142316.GA7558@oc3871087118.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yury.norov@gmail.com \
/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
all inboxes | Powered by JetHome®