Skip to content

Commit

Permalink
kfifo: Make kfifo_initialized work after kfifo_free
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Stefani Seibold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Anton Vorontsov authored and gregkh committed Feb 16, 2010
1 parent 1ebca9d commit 1a02d59
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/kfifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1a02d59

Please sign in to comment.