mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] log2: add missing () around n in roundup_pow_of_two()
@ 2020-08-31 14:50 Jason Gunthorpe
  0 siblings, 0 replies; only message in thread
From: Jason Gunthorpe @ 2020-08-31 14:50 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: Andrew Morton, David Howells

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>
---
 include/linux/log2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Hi Andrew, I think this is appropriate for your tree? Thanks

diff --git a/include/linux/log2.h b/include/linux/log2.h
index 83a4a3ca3e8a76..c619ec6eff4aee 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -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)			\
-- 
2.28.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-31 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 14:50 [PATCH] log2: add missing () around n in roundup_pow_of_two() Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®