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: Rusty Russell <rusty@rustcorp.com.au> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>hifive-unleashed-5.1
parent
5e70030d4c
commit
c80e7a826c
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue