staging: unisys: visorutil: Remove null check before kfree
authorTapasweni Pathak <tapaswenipathak@gmail.com>
Tue, 21 Oct 2014 04:20:03 +0000 (09:50 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Oct 2014 05:43:46 +0000 (13:43 +0800)
This patch was generated by the following semantic patch:

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visorutil/procobjecttree.c

index c476036f73822862ae7d863c7b412e07628f4a57..195772d22c9edcd2cf2aa323a934883accff291c 100644 (file)
@@ -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);