提交 1a02d59a 编写于 作者: A Anton Vorontsov 提交者: 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: NAnton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: NStefani Seibold <stefani@seibold.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册