is_power_of_2-kernel/kfifo.c
PATCH 1/1 is_power_of_2-kernel/kfifo.c
Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2
Signed-off-by vignesh babu <[email protected]>
---
kernel/kfifo.c +2 -1
@@ -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)
Signature · 3 lines
Vignesh Babu BM _____________________________________________________________ "Why is it that every time I'm with you, makes me believe in magic?"
Quoted 6 lines · vignesh babu
Replacing (n & (n-1)) in the context of power of 2 checks with
is_power_of_2Signed-off-by vignesh babu <[email protected]>
Signed-off-by Stelian Pop <[email protected]>
Thanks,
Stelian.
Signature · 5 lines
Stelian Pop <[email protected]> _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors