Commit 1a02d59a authored by Anton Vorontsov's avatar Anton Vorontsov Committed by Greg Kroah-Hartman

kfifo: Make kfifo_initialized work after kfifo_free

After kfifo rework it's no longer possible to reliably know if kfifo is
usable, since after kfifo_free(), kfifo_initialized() would still return
true. The correct behaviour is needed for at least FHCI USB driver.

This patch fixes the issue by resetting the kfifo to zero values (the
same approach is used in kfifo_alloc() if allocation failed).
Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: default avatarStefani Seibold <stefani@seibold.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1ebca9da
......@@ -97,6 +97,7 @@ EXPORT_SYMBOL(kfifo_alloc);
void kfifo_free(struct kfifo *fifo)
{
kfree(fifo->buffer);
_kfifo_init(fifo, NULL, 0);
}
EXPORT_SYMBOL(kfifo_free);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment