Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f84d5a76 authored by vignesh babu's avatar vignesh babu Committed by Linus Torvalds
Browse files

is_power_of_2: kernel/kfifo.c



Replace (n & (n-1)) with is_power_of_2()

Signed-off-by: default avatarvignesh babu <vignesh.babu@wipro.com>
Acked-by: default avatarStelian Pop <stelian@popies.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cf99abac
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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)