From 8d02c02253457a1facf077d8d67aa350ac317878 Mon Sep 17 00:00:00 2001 From: Tapasweni Pathak Date: Tue, 21 Oct 2014 09:50:03 +0530 Subject: [PATCH] staging: unisys: visorutil: Remove null check before kfree This patch was generated by the following semantic patch: // @@ expression E; @@ - if (E != NULL) { kfree(E); } + kfree(E); @@ expression E; @@ - if (E != NULL) { kfree(E); E = NULL; } + kfree(E); + E = NULL; // Signed-off-by: Tapasweni Pathak Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorutil/procobjecttree.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c index c476036f7382..195772d22c9e 100644 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ b/drivers/staging/unisys/visorutil/procobjecttree.c @@ -320,19 +320,18 @@ void visor_proc_DestroyObject(MYPROCOBJECT *obj) kfree(obj->procDirProperties); obj->procDirProperties = NULL; } - if (obj->procDirPropertyContexts != NULL) { - kfree(obj->procDirPropertyContexts); - obj->procDirPropertyContexts = NULL; - } + + kfree(obj->procDirPropertyContexts); + obj->procDirPropertyContexts = NULL; + if (obj->procDir != NULL) { if (obj->name != NULL) remove_proc_entry(obj->name, type->procDir); obj->procDir = NULL; } - if (obj->name != NULL) { - kfree(obj->name); - obj->name = NULL; - } + + kfree(obj->name); + obj->name = NULL; kfree(obj); } EXPORT_SYMBOL_GPL(visor_proc_DestroyObject); -- 2.30.2