From: zhong jiang Date: Tue, 30 Oct 2018 22:05:37 +0000 (-0700) Subject: lib/sg_pool.c: remove unnecessary null check when freeing object X-Git-Tag: v5.4-rc1~2304^2~71 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f476715d05f53915f0390e074a6988ce6a12f36;p=platform%2Fkernel%2Flinux-rpi.git lib/sg_pool.c: remove unnecessary null check when freeing object mempool_destroy(NULL) and kmem_cache_destroy(NULL) are legal Link: http://lkml.kernel.org/r/1533054107-35657-1-git-send-email-zhongjiang@huawei.com Signed-off-by: zhong jiang Cc: Thomas Gleixner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/sg_pool.c b/lib/sg_pool.c index 6dd3061..d1c1e63 100644 --- a/lib/sg_pool.c +++ b/lib/sg_pool.c @@ -148,10 +148,9 @@ static __init int sg_pool_init(void) cleanup_sdb: for (i = 0; i < SG_MEMPOOL_NR; i++) { struct sg_pool *sgp = sg_pools + i; - if (sgp->pool) - mempool_destroy(sgp->pool); - if (sgp->slab) - kmem_cache_destroy(sgp->slab); + + mempool_destroy(sgp->pool); + kmem_cache_destroy(sgp->slab); } return -ENOMEM;