diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-07-15 23:42:00 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 09:05:52 -0700 |
commit | c80e7a826c10cf5bce8487fbaede48bd0bd48d08 (patch) | |
tree | 90a8f4dd0c936eacab217a183a9ff311ad259a32 /mm/mempool.c | |
parent | 5e70030d4cf91613530a23b40ad9919bb9ee114f (diff) | |
download | lwn-c80e7a826c10cf5bce8487fbaede48bd0bd48d08.tar.gz lwn-c80e7a826c10cf5bce8487fbaede48bd0bd48d08.zip |
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>
Diffstat (limited to 'mm/mempool.c')
-rw-r--r-- | mm/mempool.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/mempool.c b/mm/mempool.c index cc1ca86dfc24..3e8f1fed0e1f 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -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); |