mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 11:16:11 +00:00
is_power_of_2: kernel/kfifo.c
Replace (n & (n-1)) with is_power_of_2() Signed-off-by: vignesh babu <vignesh.babu@wipro.com> Acked-by: Stelian Pop <stelian@popies.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
cf99abace7
commit
f84d5a76c5
1 changed files with 2 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/kfifo.h>
|
||||
#include <linux/log2.h>
|
||||
|
||||
/**
|
||||
* kfifo_init - allocates a new FIFO using a preallocated buffer
|
||||
|
@ -41,7 +42,7 @@ struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size,
|
|||
struct kfifo *fifo;
|
||||
|
||||
/* size must be a power of 2 */
|
||||
BUG_ON(size & (size - 1));
|
||||
BUG_ON(!is_power_of_2(size));
|
||||
|
||||
fifo = kmalloc(sizeof(struct kfifo), gfp_mask);
|
||||
if (!fifo)
|
||||
|
|
Loading…
Reference in a new issue