linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Oleg Drokin <oleg.drokin@intel.com>
Cc: kernel-janitors@vger.kernel.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/20] staging: lustre: ldlm: ldlm_lib: remove unneeded null test before free
Date: Fri,  1 May 2015 21:38:06 +0200	[thread overview]
Message-ID: <1430509086-22132-21-git-send-email-Julia.Lawall@lip6.fr> (raw)
In-Reply-To: <1430509086-22132-1-git-send-email-Julia.Lawall@lip6.fr>

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>

---
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
index d066771..0a0b435 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
@@ -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;


  parent reply	other threads:[~2015-05-01 19:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 19:37 [PATCH 0/20] remove unneeded null test before free Julia Lawall
2015-05-01 19:37 ` [PATCH 20/20] staging: lustre: ptlrpc: service: " Julia Lawall
2015-05-01 19:37 ` [PATCH 19/20] staging: lustre: ptlrpc: sec_plain: " Julia Lawall
2015-05-02  9:14   ` walter harms
2015-05-01 19:37 ` [PATCH 18/20] Staging: lustre: ptlrpc: lproc_ptlrpc: " Julia Lawall
2015-05-01 19:37 ` [PATCH 17/20] Staging: lustre: osc: " Julia Lawall
2015-05-01 19:37 ` [PATCH 16/20] staging: lustre: obdecho: " Julia Lawall
2015-05-01 19:37 ` [PATCH 15/20] staging: lustre: obdclass: obd_mount: " Julia Lawall
2015-05-01 19:37 ` [PATCH 14/20] staging: lustre: obdclass: obd_config: " Julia Lawall
2015-05-01 19:37 ` [PATCH 13/20] staging: lustre: obdclass: llog: " Julia Lawall
2015-05-01 19:37 ` [PATCH 12/20] staging: lustre: obdclass: genops: " Julia Lawall
2015-05-01 19:37 ` [PATCH 11/20] staging: lustre: mdc: " Julia Lawall
2015-05-01 19:37 ` [PATCH 10/20] staging: lustre: lov: lov_dev: " Julia Lawall
2015-05-01 19:37 ` [PATCH 9/20] staging: lustre: lmv: " Julia Lawall
2015-05-01 19:37 ` [PATCH 8/20] staging: lustre: llite: statahead: " Julia Lawall
2015-05-01 19:38 ` [PATCH 7/20] Staging: lustre: llite: llite_lib: " Julia Lawall
2015-05-01 19:38 ` [PATCH 6/20] Staging: lustre: llite: file: " Julia Lawall
2015-05-01 19:38 ` [PATCH 5/20] Staging: lustre: llite: dir: " Julia Lawall
2015-05-01 19:38 ` [PATCH 4/20] staging: lustre: libcfs: linux: " Julia Lawall
2015-05-01 19:38 ` [PATCH 3/20] staging: lustre: ldlm: ldlm_resource: " Julia Lawall
2015-05-01 19:38 ` [PATCH 2/20] staging: lustre: ldlm: ldlm_lock: " Julia Lawall
2015-05-01 19:38 ` Julia Lawall [this message]
2015-05-02 20:55   ` [PATCH 1/20] staging: lustre: ldlm: ldlm_lib: " Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430509086-22132-21-git-send-email-Julia.Lawall@lip6.fr \
    --to=julia.lawall@lip6.fr \
    --cc=HPDD-discuss@ml01.01.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).