mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Gavin Shan <gshan@redhat.com>
Cc: linux-kernel@vger.kernel.org, yury.norov@gmail.com,
	linux@rasmusvillemoes.dk, shan.gavin@gmail.com
Subject: Re: [PATCH] nodemask: Drop duplicate check in for_each_node_mask()
Date: Tue, 24 Jan 2023 12:24:43 +0200	[thread overview]
Message-ID: <Y8+x64IxlP+pfLho@smile.fi.intel.com> (raw)
In-Reply-To: <20230124000243.415621-1-gshan@redhat.com>

On Tue, Jan 24, 2023 at 08:02:43AM +0800, Gavin Shan wrote:
> The return value type is changed from 'int' to 'unsigned int' since
> commit 0dfe54071d7c8 ("nodemask: Fix return values to be unsigned").
> Besides, the conversion between 'int' and 'unsigned int' on the
> parameter @node is guaranteed to be safe due to the limited range of
> MAX_NUMNODES and CONFIG_NODES_SHIFT. By the way, '(node >= 0)' should
> have been '(node) >= 0' actually.
> 
> It's unnecessary to check if their return values are greater or equal
> to 0 in for_each_node_mask(). Remove it.
> 
> No functional change intended.

Agree on the arguments.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Gavin Shan <gshan@redhat.com>
> ---
>  include/linux/nodemask.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
> index bb0ee80526b2..8d07116caaf1 100644
> --- a/include/linux/nodemask.h
> +++ b/include/linux/nodemask.h
> @@ -385,7 +385,7 @@ static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,
>  #if MAX_NUMNODES > 1
>  #define for_each_node_mask(node, mask)				    \
>  	for ((node) = first_node(mask);				    \
> -	     (node >= 0) && (node) < MAX_NUMNODES;		    \
> +	     (node) < MAX_NUMNODES;				    \
>  	     (node) = next_node((node), (mask)))
>  #else /* MAX_NUMNODES == 1 */
>  #define for_each_node_mask(node, mask)                                  \
> -- 
> 2.23.0
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-01-24 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24  0:02 Gavin Shan
2023-01-24 10:24 ` Andy Shevchenko [this message]
2023-03-02  7:05 ` Yury Norov

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=Y8+x64IxlP+pfLho@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=gshan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=shan.gavin@gmail.com \
    --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®