From: Tapasweni Pathak Date: Tue, 21 Oct 2014 04:20:03 +0000 (+0530) Subject: staging: unisys: visorutil: Remove null check before kfree X-Git-Tag: firefly_0821_release~176^2~2665^2~1040 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8d02c02253457a1facf077d8d67aa350ac317878;p=firefly-linux-kernel-4.4.55.git 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 --- 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);