kmem_cache_destroy has taken the null check into account. so just remove the unnecessary check.
Signed-off-by: zhong jiang <zhongji...@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