Skip to content

Commit

Permalink
include/linux/log2.h: add missing () around n in roundup_pow_of_two()
Browse files Browse the repository at this point in the history
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 <jgg@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.kernel.org/r/0-v1-8a2697e3c003+41165-log_brackets_jgg@nvidia.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jason Gunthorpe authored and Linus Torvalds committed Sep 5, 2020
1 parent e5a59d3 commit 428fc0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/log2.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
#define roundup_pow_of_two(n) \
( \
__builtin_constant_p(n) ? ( \
(n == 1) ? 1 : \
((n) == 1) ? 1 : \
(1UL << (ilog2((n) - 1) + 1)) \
) : \
__roundup_pow_of_two(n) \
Expand Down

0 comments on commit 428fc0a

Please sign in to comment.