linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib/debugobjects: remove redundant check when free the object
@ 2018-07-31 16:24 zhong jiang
  2018-08-02 11:57 ` [tip:core/debugobjects] debugobjects: Remove redundant NULL pointer check tip-bot for Zhong Jiang
  0 siblings, 1 reply; 2+ messages in thread
From: zhong jiang @ 2018-07-31 16:24 UTC (permalink / raw)
  To: tglx, longman; +Cc: arnd, yang.shi, linux-kernel

kmem_cache_destroy has taken the null check into account. so just
remove the unnecessary check.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 lib/debugobjects.c | 3 +--
 1 file changed, 1 insertion(+), 2 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();
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:core/debugobjects] debugobjects: Remove redundant NULL pointer check
  2018-07-31 16:24 [PATCH] lib/debugobjects: remove redundant check when free the object zhong jiang
@ 2018-08-02 11:57 ` tip-bot for Zhong Jiang
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Zhong Jiang @ 2018-08-02 11:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: yang.shi, zhongjiang, arnd, mingo, longman, hpa, tglx, linux-kernel

Commit-ID:  3ff4f80a74fd38398ae1bd8a458ba9c51aa0dd44
Gitweb:     https://git.kernel.org/tip/3ff4f80a74fd38398ae1bd8a458ba9c51aa0dd44
Author:     Zhong Jiang <zhongjiang@huawei.com>
AuthorDate: Wed, 1 Aug 2018 00:24:58 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 2 Aug 2018 13:53:04 +0200

debugobjects: Remove redundant NULL pointer check

kmem_cache_destroy() has a built in NULL pointer check, so the one at the
call can be removed.

Signed-off-by: Zhong Jiang <zhongjiang@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: <longman@redhat.com>
Cc: <arnd@arndb.de>
Cc: <yang.shi@linux.alibaba.com>
Link: https://lkml.kernel.org/r/1533054298-35824-1-git-send-email-zhongjiang@huawei.com

---
 lib/debugobjects.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 24c1df0d7466..70935ed91125 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -1188,8 +1188,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();

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-02 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 16:24 [PATCH] lib/debugobjects: remove redundant check when free the object zhong jiang
2018-08-02 11:57 ` [tip:core/debugobjects] debugobjects: Remove redundant NULL pointer check tip-bot for 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).