]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
permit mempool_free(NULL)
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 16 Jul 2007 06:42:00 +0000 (23:42 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 16 Jul 2007 16:05:52 +0000 (09:05 -0700)
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>
mm/mempool.c

index cc1ca86dfc2496b6e0cae7703d4a6dc4f4f97150..3e8f1fed0e1f8accce8d9b931e59ba432ab92d53 100644 (file)
@@ -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);