From: Anton Vorontsov Date: Wed, 27 Jan 2010 14:09:34 +0000 (+0300) Subject: kfifo: Make kfifo_initialized work after kfifo_free X-Git-Url: http://git.osdn.net/view?p=armadillo-ux%2Flinux-2.6-armadillo.git;a=commitdiff_plain;h=1a02d59aba9b61b820517fb135086471c065b573 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: Anton Vorontsov Acked-by: Stefani Seibold Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/kfifo.c b/kernel/kfifo.c index 498cabba225..559fb5582b6 100644 --- a/kernel/kfifo.c +++ b/kernel/kfifo.c @@ -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);