Commit c80e7a82 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

permit mempool_free(NULL)

Christian Borntraeger points out that mempool_free() doesn't noop when
handed NULL.  This is inconsistent with the other free-like functions
in the kernel.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5e70030d
...@@ -263,6 +263,9 @@ void mempool_free(void *element, mempool_t *pool) ...@@ -263,6 +263,9 @@ void mempool_free(void *element, mempool_t *pool)
{ {
unsigned long flags; unsigned long flags;
if (unlikely(element == NULL))
return;
smp_mb(); smp_mb();
if (pool->curr_nr < pool->min_nr) { if (pool->curr_nr < pool->min_nr) {
spin_lock_irqsave(&pool->lock, flags); spin_lock_irqsave(&pool->lock, flags);
......
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