From: Rolf Eike Beer Date: Thu, 17 May 2007 21:56:56 +0000 (+0200) Subject: Fix roundup_pow_of_two(1) X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1a06a52ee1b0;p=linux-beck.git Fix roundup_pow_of_two(1) 1 is a power of two, therefore roundup_pow_of_two(1) should return 1. It does in case the argument is a variable but in case it's a constant it behaves wrong and returns 0. Probably nobody ever did it so this was never noticed. Signed-off-by: Rolf Eike Beer Signed-off-by: Linus Torvalds --- diff --git a/include/linux/log2.h b/include/linux/log2.h index 57e641e19a81..1b8a2c1cb0e3 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h @@ -159,7 +159,7 @@ unsigned long __roundup_pow_of_two(unsigned long n) #define roundup_pow_of_two(n) \ ( \ __builtin_constant_p(n) ? ( \ - (n == 1) ? 0 : \ + (n == 1) ? 1 : \ (1UL << (ilog2((n) - 1) + 1)) \ ) : \ __roundup_pow_of_two(n) \