diff options
author | zhong jiang <zhongjiang@huawei.com> | 2018-10-30 15:05:37 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-31 08:54:13 -0700 |
commit | 7f476715d05f53915f0390e074a6988ce6a12f36 (patch) | |
tree | 9f59abf8200f2115fa39dbbfcb013cd61bca7dd0 /lib | |
parent | 7a20c2fa1cc6edc1c3d1d40174fc30d1bbafa4d1 (diff) | |
download | linux-7f476715d05f53915f0390e074a6988ce6a12f36.tar.bz2 |
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 <zhongjiang@huawei.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sg_pool.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/sg_pool.c b/lib/sg_pool.c index 6dd30615a201..d1c1e6388eaa 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; |