Skip to content

Commit

Permalink
lib/sg_pool.c: remove unnecessary null check when freeing object
Browse files Browse the repository at this point in the history
mempool_destroy(NULL) and kmem_cache_destroy(NULL) are legal

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: zhong jiang <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
xiongzhongjiang authored and torvalds committed Oct 31, 2018
1 parent 7a20c2f commit 7f47671
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/sg_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7f47671

Please sign in to comment.