Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

include/linux/log2.h: add missing () around n in roundup_pow_of_two()

Otherwise gcc generates warnings if the expression is complicated.

Fixes: 312a0c170945 ("[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>

authored by

Jason Gunthorpe and committed by
Linus Torvalds
428fc0af e5a59d30

+1 -1
+1 -1
include/linux/log2.h
··· 173 173 #define roundup_pow_of_two(n) \ 174 174 ( \ 175 175 __builtin_constant_p(n) ? ( \ 176 - (n == 1) ? 1 : \ 176 + ((n) == 1) ? 1 : \ 177 177 (1UL << (ilog2((n) - 1) + 1)) \ 178 178 ) : \ 179 179 __roundup_pow_of_two(n) \