* [PATCH] lib/sg_pool,debugobjects: remove unnecessary null check when free the object
@ 2018-07-31 15:55 zhong jiang
2018-07-31 16:21 ` Thomas Gleixner
0 siblings, 1 reply; 3+ messages in thread
From: zhong jiang @ 2018-07-31 15:55 UTC (permalink / raw)
To: tglx, longman; +Cc: yang.shi, arnd, linux-kernel
kmem_cache_destroy/mempool_destroy has taken null check into account.
so remove the redundant check.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
lib/debugobjects.c | 3 +--
lib/sg_pool.c | 7 +++----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 994be48..7a6d80b 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -1185,8 +1185,7 @@ void __init debug_objects_mem_init(void)
if (!obj_cache || debug_objects_replace_static_objects()) {
debug_objects_enabled = 0;
- if (obj_cache)
- kmem_cache_destroy(obj_cache);
+ kmem_cache_destroy(obj_cache);
pr_warn("out of memory.\n");
} else
debug_objects_selftest();
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;
--
1.7.12.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/sg_pool,debugobjects: remove unnecessary null check when free the object
2018-07-31 15:55 [PATCH] lib/sg_pool,debugobjects: remove unnecessary null check when free the object zhong jiang
@ 2018-07-31 16:21 ` Thomas Gleixner
2018-07-31 16:27 ` zhong jiang
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2018-07-31 16:21 UTC (permalink / raw)
To: zhong jiang; +Cc: longman, yang.shi, arnd, linux-kernel
On Tue, 31 Jul 2018, zhong jiang wrote:
> kmem_cache_destroy/mempool_destroy has taken null check into account.
> so remove the redundant check.
Please split the patch so they can be applied independently by the relevant
maintainers.
Thanks,
tglx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/sg_pool,debugobjects: remove unnecessary null check when free the object
2018-07-31 16:21 ` Thomas Gleixner
@ 2018-07-31 16:27 ` zhong jiang
0 siblings, 0 replies; 3+ messages in thread
From: zhong jiang @ 2018-07-31 16:27 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: longman, yang.shi, arnd, linux-kernel
On 2018/8/1 0:21, Thomas Gleixner wrote:
> On Tue, 31 Jul 2018, zhong jiang wrote:
>
>> kmem_cache_destroy/mempool_destroy has taken null check into account.
>> so remove the redundant check.
> Please split the patch so they can be applied independently by the relevant
> maintainers.
>
> Thanks,
>
> tglx
>
> .
>
Ok, will do .
Thanks,
zhong jiang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-31 16:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 15:55 [PATCH] lib/sg_pool,debugobjects: remove unnecessary null check when free the object zhong jiang
2018-07-31 16:21 ` Thomas Gleixner
2018-07-31 16:27 ` zhong jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).