]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
Fix roundup_pow_of_two(1)
authorRolf Eike Beer <eike-kernel@sf-tec.de>
Thu, 17 May 2007 21:56:56 +0000 (23:56 +0200)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 19 May 2007 03:46:30 +0000 (20:46 -0700)
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 <eike-kernel@sf-tec.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/log2.h

index 57e641e19a8106122783073291cf53adfc36acd0..1b8a2c1cb0e30e36ac1369372453dba264d4c3f9 100644 (file)
@@ -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)                 \