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.law...@lip6.fr>

---
 drivers/staging/lustre/lustre/obdecho/echo_client.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c 
b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index cf64538..5376178 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -1737,10 +1737,8 @@ static int echo_client_prep_commit(const struct lu_env 
*env,
        }
 
 out:
-       if (lnb)
-               kfree(lnb);
-       if (rnb)
-               kfree(rnb);
+       kfree(lnb);
+       kfree(rnb);
        return ret;
 }
 

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to