[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160321131816.GA8270@xian.intel.com>
Date: Mon, 21 Mar 2016 21:18:16 +0800
From: kbuild test robot <lkp@...el.com>
To: Alexandre Bounine <alexandre.bounine@....com>
Cc: kbuild-all@...org, Andrew Morton <akpm@...ux-foundation.org>,
Alexandre Bounine <alexandre.bounine@....com>,
Matt Porter <mporter@...nel.crashing.org>,
Aurelien Jacquiot <a-jacquiot@...com>,
Andre van Herk <andre.van.herk@...drive-technologies.com>,
Barry Wood <barry.wood@....com>, linux-kernel@...r.kernel.org
Subject: [PATCH] rapidio: fix ifnullfree.cocci warnings
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@....com>
Signed-off-by: Fengguang Wu <fengguang.wu@...el.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);
}
Powered by blists - more mailing lists