* [PATCH] nodemask: Drop duplicate check in for_each_node_mask()
@ 2023-01-24 0:02 Gavin Shan
2023-01-24 10:24 ` Andy Shevchenko
2023-03-02 7:05 ` Yury Norov
0 siblings, 2 replies; 3+ messages in thread
From: Gavin Shan @ 2023-01-24 0:02 UTC (permalink / raw)
To: linux-kernel; +Cc: yury.norov, andriy.shevchenko, linux, shan.gavin
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.
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nodemask: Drop duplicate check in for_each_node_mask()
2023-01-24 0:02 [PATCH] nodemask: Drop duplicate check in for_each_node_mask() Gavin Shan
@ 2023-01-24 10:24 ` Andy Shevchenko
2023-03-02 7:05 ` Yury Norov
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-01-24 10:24 UTC (permalink / raw)
To: Gavin Shan; +Cc: linux-kernel, yury.norov, linux, shan.gavin
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nodemask: Drop duplicate check in for_each_node_mask()
2023-01-24 0:02 [PATCH] nodemask: Drop duplicate check in for_each_node_mask() Gavin Shan
2023-01-24 10:24 ` Andy Shevchenko
@ 2023-03-02 7:05 ` Yury Norov
1 sibling, 0 replies; 3+ messages in thread
From: Yury Norov @ 2023-03-02 7:05 UTC (permalink / raw)
To: Gavin Shan; +Cc: linux-kernel, andriy.shevchenko, linux, shan.gavin
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.
>
> Signed-off-by: Gavin Shan <gshan@redhat.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-02 7:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 0:02 [PATCH] nodemask: Drop duplicate check in for_each_node_mask() Gavin Shan
2023-01-24 10:24 ` Andy Shevchenko
2023-03-02 7:05 ` Yury Norov
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.