Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1361835
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] rapidio: fix ifnullfree.cocci warnings |
| Date | 2016-03-21 14:30 +0100 |
| Message-ID | <rf84c-6fl-53@gated-at.bofh.it> (permalink) |
| References | <rf84c-6fl-45@gated-at.bofh.it> <rf6vo-4Zw-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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);
}
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH] rapidio: add RapidIO channelized messaging driver kbuild test robot <lkp@intel.com> - 2016-03-21 14:30 +0100 [PATCH] rapidio: fix ifnullfree.cocci warnings kbuild test robot <lkp@intel.com> - 2016-03-21 14:30 +0100
csiph-web