From: Vignesh Babu BM Date: Tue, 8 May 2007 07:24:32 +0000 (-0700) Subject: is_power_of_2 in fs/block_dev.c X-Git-Tag: v2.6.22-rc1~783 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1368c4f2482c9e06bcb297217433818b171cc9e3;p=linux-2.6 is_power_of_2 in fs/block_dev.c Replace (n & (n-1)) in the context of power of 2 checks with is_power_of_2 Signed-off-by: vignesh babu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/block_dev.c b/fs/block_dev.c index f02b7bdd98..7428992408 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "internal.h" @@ -67,7 +68,7 @@ static void kill_bdev(struct block_device *bdev) int set_blocksize(struct block_device *bdev, int size) { /* Size must be a power of two, and between 512 and PAGE_SIZE */ - if (size > PAGE_SIZE || size < 512 || (size & (size-1))) + if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size)) return -EINVAL; /* Size cannot be smaller than the size supported by the device */