summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2020-09-04 16:36:19 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-09 19:04:28 +0200
commit95968e5cbb5db7ff33288d01a95349d476f19248 (patch)
tree804a8d3978b62b669db676858d01114e3b931688 /include
parentb0a3e33221cc9e6ba141d9d62c178c9022f56989 (diff)
downloadlinux-stable-95968e5cbb5db7ff33288d01a95349d476f19248.tar.gz
linux-stable-95968e5cbb5db7ff33288d01a95349d476f19248.tar.bz2
linux-stable-95968e5cbb5db7ff33288d01a95349d476f19248.zip
include/linux/log2.h: add missing () around n in roundup_pow_of_two()
[ Upstream commit 428fc0aff4e59399ec719ffcc1f7a5d29a4ee476 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/log2.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/log2.h b/include/linux/log2.h
index 2af7f77866d0..78496801cddf 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -177,7 +177,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) \