From: Rusty Russell Date: Mon, 16 Jul 2007 06:42:00 +0000 (-0700) Subject: permit mempool_free(NULL) X-Git-Tag: v2.6.23-rc1~791 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=c80e7a826c10cf5bce8487fbaede48bd0bd48d08;p=linux-2.6-omap-h63xx.git 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 Cc: Christian Borntraeger Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mempool.c b/mm/mempool.c index cc1ca86dfc2..3e8f1fed0e1 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);