aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kfifo.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kfifo.c')
-rw-r--r--lib/kfifo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/kfifo.c b/lib/kfifo.c
index 117ad0e7fbf4..12f5a347aa13 100644
--- a/lib/kfifo.c
+++ b/lib/kfifo.c
@@ -68,7 +68,8 @@ int __kfifo_init(struct __kfifo *fifo, void *buffer,
{
size /= esize;
- size = roundup_pow_of_two(size);
+ if (!is_power_of_2(size))
+ size = rounddown_pow_of_two(size);
fifo->in = 0;
fifo->out = 0;
@@ -414,7 +415,7 @@ static unsigned int __kfifo_peek_n(struct __kfifo *fifo, size_t recsize)
)
/*
- * __kfifo_poke_n internal helper function for storeing the length of
+ * __kfifo_poke_n internal helper function for storing the length of
* the record into the fifo
*/
static void __kfifo_poke_n(struct __kfifo *fifo, unsigned int n, size_t recsize)