staging: lustre: ldlm: ldlm_lock: remove unneeded null test before free
authorJulia Lawall <Julia.Lawall@lip6.fr>
Fri, 1 May 2015 19:38:05 +0000 (21:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 07:23:51 +0000 (09:23 +0200)
Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c

index 2c5fe1499ce0754f41f77e0704212aa3df920fbb..6a22f4183b308728d27a77e457409ec801bdfb40 100644 (file)
@@ -208,8 +208,7 @@ void ldlm_lock_put(struct ldlm_lock *lock)
                        lock->l_export = NULL;
                }
 
-               if (lock->l_lvb_data != NULL)
-                       kfree(lock->l_lvb_data);
+               kfree(lock->l_lvb_data);
 
                ldlm_interval_free(ldlm_interval_detach(lock));
                lu_ref_fini(&lock->l_reference);