public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: kbuild-all@01.org, Andrew Morton <akpm@linux-foundation.org>,
	Alexandre Bounine <alexandre.bounine@idt.com>,
	Matt Porter <mporter@kernel.crashing.org>,
	Aurelien Jacquiot <a-jacquiot@ti.com>,
	Andre van Herk <andre.van.herk@prodrive-technologies.com>,
	Barry Wood <barry.wood@idt.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] rapidio: fix ifnullfree.cocci warnings
Date: Mon, 21 Mar 2016 21:18:16 +0800	[thread overview]
Message-ID: <20160321131816.GA8270@xian.intel.com> (raw)
In-Reply-To: <1458560281-17420-1-git-send-email-alexandre.bounine@idt.com>

drivers/rapidio/rio_cm.c:1401:4-9: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
drivers/rapidio/rio_cm.c:1408:4-9: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Alexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 rio_cm.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/rapidio/rio_cm.c
+++ b/drivers/rapidio/rio_cm.c
@@ -1397,15 +1397,15 @@ static void riocm_ch_free(struct kref *r
 
 	if (ch->rx_ring.inuse_cnt) {
 		for (i = 0; i < RIOCM_RX_RING_SIZE; i++) {
-			if (ch->rx_ring.inuse[i] != NULL)
-				kfree(ch->rx_ring.inuse[i]);
+			kfree(ch->rx_ring.inuse[i]);
 		}
 	}
 
 	if (ch->rx_ring.count)
 		for (i = 0; i < RIOCM_RX_RING_SIZE; i++)
-			if (ch->rx_ring.buf[i] != NULL)
-				kfree(ch->rx_ring.buf[i]);
+		{
+			kfree(ch->rx_ring.buf[i]);
+		}
 
 	complete(&ch->comp_close);
 }

  parent reply	other threads:[~2016-03-21 13:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-21 11:38 [PATCH] rapidio: add RapidIO channelized messaging driver Alexandre Bounine
2016-03-21 13:18 ` kbuild test robot
2016-03-21 13:18 ` kbuild test robot [this message]
2016-03-23 21:48 ` Andrew Morton

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=20160321131816.GA8270@xian.intel.com \
    --to=lkp@intel.com \
    --cc=a-jacquiot@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexandre.bounine@idt.com \
    --cc=andre.van.herk@prodrive-technologies.com \
    --cc=barry.wood@idt.com \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mporter@kernel.crashing.org \
    /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