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 4/20] staging: lustre: libcfs: linux: remove unneeded null test before free
Date: Fri,  1 May 2015 21:38:03 +0200	[thread overview]
Message-ID: <1430509086-22132-18-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);
  ptr = NULL;
- }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index c8e2930..483cbc8 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -102,11 +102,10 @@ void cfs_tracefile_fini_arch(void)
 	int    j;
 
 	for (i = 0; i < num_possible_cpus(); i++)
-		for (j = 0; j < 3; j++)
-			if (cfs_trace_console_buffers[i][j] != NULL) {
-				kfree(cfs_trace_console_buffers[i][j]);
-				cfs_trace_console_buffers[i][j] = NULL;
-			}
+		for (j = 0; j < 3; j++) {
+			kfree(cfs_trace_console_buffers[i][j]);
+			cfs_trace_console_buffers[i][j] = NULL;
+		}
 
 	for (i = 0; cfs_trace_data[i] != NULL; i++) {
 		kfree(cfs_trace_data[i]);


  parent reply	other threads:[~2015-05-01 19:48 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 ` Julia Lawall [this message]
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 ` [PATCH 1/20] staging: lustre: ldlm: ldlm_lib: " Julia Lawall
2015-05-02 20:55   ` 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-18-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).