Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752850AbbEATro (ORCPT ); Fri, 1 May 2015 15:47:44 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:44703 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751888AbbEATqy (ORCPT ); Fri, 1 May 2015 15:46:54 -0400 X-IronPort-AV: E=Sophos;i="5.13,351,1427752800"; d="scan'208";a="138560676" From: Julia Lawall To: Oleg Drokin Cc: kernel-janitors@vger.kernel.org, Andreas Dilger , Greg Kroah-Hartman , HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/20] staging: lustre: ldlm: ldlm_resource: remove unneeded null test before free Date: Fri, 1 May 2015 21:38:04 +0200 Message-Id: <1430509086-22132-19-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1430509086-22132-1-git-send-email-Julia.Lawall@lip6.fr> References: <1430509086-22132-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1417 Lines: 43 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 --- 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 5922069..7149eda 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/