staging: lustre: ldlm: ldlm_lib: remove unneeded null test before free
authorJulia Lawall <Julia.Lawall@lip6.fr>
Fri, 1 May 2015 19:38:06 +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_lib.c

index d0667715ebf704ae5be5ad3e2d899534019695fd..0a0b435f11fcfad11c7dceacdf5f64a2d694ec2c 100644 (file)
@@ -119,8 +119,7 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid,
        spin_unlock(&imp->imp_lock);
        return 0;
 out_free:
-       if (imp_conn)
-               kfree(imp_conn);
+       kfree(imp_conn);
 out_put:
        ptlrpc_connection_put(ptlrpc_conn);
        return rc;