Peter Zijlstra
2022-Apr-14 15:23 UTC
[PATCH 2/3] nodemask.h: Fix compilation error with GCC12
On Thu, Apr 14, 2022 at 05:08:54PM +0200, Christophe de Dinechin wrote:> diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h > index 567c3ddba2c4..c6199dbe2591 100644 > --- a/include/linux/nodemask.h > +++ b/include/linux/nodemask.h > @@ -375,14 +375,13 @@ 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) < MAX_NUMNODES; \ > - (node) = next_node((node), (mask))) > +#define for_each_node_mask(node, mask) \ > + for ((node) = first_node(mask); \ > + (node >= 0) && (node) < MAX_NUMNODES; \ > + (node) = next_node((node), (mask))) > #else /* MAX_NUMNODES == 1 */ > -#define for_each_node_mask(node, mask) \ > - if (!nodes_empty(mask)) \ > - for ((node) = 0; (node) < 1; (node)++) > +#define for_each_node_mask(node, mask) \ > + for ((node) = 0; (node) < 1 && !nodes_empty(mask); (node)++) > #endif /* MAX_NUMNODES */Again, less readable code :/ And why?