Skip to content

Commit

Permalink
permit mempool_free(NULL)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rustyrussell authored and Linus Torvalds committed Jul 16, 2007
1 parent 5e70030 commit c80e7a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mm/mempool.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ void mempool_free(void *element, mempool_t *pool)
{
unsigned long flags;

if (unlikely(element == NULL))
return;

smp_mb();
if (pool->curr_nr < pool->min_nr) {
spin_lock_irqsave(&pool->lock, flags);
Expand Down

0 comments on commit c80e7a8

Please sign in to comment.