From 62b497d85bf3896a7caaf244966e5288fb2e3b39 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Fri, 1 May 2015 21:38:04 +0200 Subject: [PATCH] staging: lustre: ldlm: ldlm_resource: remove unneeded null test before free 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/) // @@ expression ptr; @@ - if (ptr != NULL) { kfree(ptr); ptr = NULL; - } // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 5922069873f5..7149edab44f4 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -1137,10 +1137,8 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, CERROR("%s: lvbo_init failed for resource %#llx:%#llx: rc = %d\n", ns->ns_obd->obd_name, name->name[0], name->name[1], rc); - if (res->lr_lvb_data) { - kfree(res->lr_lvb_data); - res->lr_lvb_data = NULL; - } + kfree(res->lr_lvb_data); + res->lr_lvb_data = NULL; res->lr_lvb_len = rc; mutex_unlock(&res->lr_lvb_mutex); ldlm_resource_putref(res); -- 2.20.1