Skip to contentSkip to conversation

lib/sg_pool: remove unnecessary null check when free the object

PATCH In review zhong jiang 2 participants 6 messages Jul 31, 2018 – Sep 8, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/sg_pool: remove unnecessary null check when free the object

kmem_cache_destroy/mempool_destroy has taken null check into account. so remove the redundant check.

---
 lib/sg_pool.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
lib/sg_pool.c +3 -4
index 6dd3061..d1c1e63 100644
@@ -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;
Signature · 1 line
1.7.12.4
#1 lore raw

Hi, Thomas

Can you pick up the patch?

Thanks
zhong jiang

Quoted 26 lines · zhong jiang

kmem_cache_destroy/mempool_destroy has taken null check into account. so remove the redundant check.

---
 lib/sg_pool.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
lib/sg_pool.c +3 -4
index 6dd3061..d1c1e63 100644
@@ -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;
#2 lore raw
Quoted 3 lines · zhong jiang

Hi, Thomas

Can you pick up the patch?

I'm not picking up patches for lib/sg_pool. Why would I?

#3 lore raw
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines · zhong jiang

Hi, Thomas

Can you pick up the patch?

I'm not picking up patches for lib/sg_pool. Why would I?

I am sorry for that. I regard you as maintainer for lib/sg_pool mistakely. but I can get maintainer information nothing from get_maintainer.pl The code is not updated since 2016.

Thanks
zhong jiang

#4 lore raw
Quoted 10 lines · zhong jiang
Quoted 6 lines · Thomas Gleixner
Quoted 3 lines · zhong jiang

Hi, Thomas

Can you pick up the patch?

I'm not picking up patches for lib/sg_pool. Why would I?

I am sorry for that. I regard you as maintainer for lib/sg_pool mistakely. but I can get maintainer information nothing from get_maintainer.pl The code is not updated since 2016.

Andrew Morton picks up such things.

Thanks,

tglx

#5 lore raw
Quoted 6 lines · Thomas Gleixner
Quoted 4 lines · zhong jiang
Quoted 3 lines · Thomas Gleixner
Quoted 2 lines · zhong jiang

Hi, Thomas

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Can you pick up the patch?

I'm not picking up patches for lib/sg_pool. Why would I?

I am sorry for that. I regard you as maintainer for lib/sg_pool mistakely. but I can get maintainer information nothing from get_maintainer.pl The code is not updated since 2016.

Andrew Morton picks up such things.

Thank you for your tips.

+to Andrew

Thanks
zhong jiang

Quoted 6 lines

Thanks,

tglx

.