Skip to content

Commit 428fc0a

Browse files
jgunthorpetorvalds
authored andcommitted
include/linux/log2.h: add missing () around n in roundup_pow_of_two()
Otherwise gcc generates warnings if the expression is complicated. Fixes: 312a0c1 ("[PATCH] LOG2: Alter roundup_pow_of_two() so that it can use a ilog2() on a constant") Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent e5a59d3 commit 428fc0a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/log2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
173173
#define roundup_pow_of_two(n) \
174174
( \
175175
__builtin_constant_p(n) ? ( \
176-
(n == 1) ? 1 : \
176+
((n) == 1) ? 1 : \
177177
(1UL << (ilog2((n) - 1) + 1)) \
178178
) : \
179179
__roundup_pow_of_two(n) \

0 commit comments

Comments
 (0)