lkml.org 
[lkml]   [2017]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] staging: lustre: fix ifnullfree.cocci warnings
From: Fengguang Wu <fengguang.wu@intel.com>

drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:886:2-7: 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

Fixes: 862af72835c1 ("staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.")
CC: NeilBrown <neilb@suse.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

o2iblnd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -882,8 +882,7 @@ void kiblnd_destroy_conn(struct kib_conn
IBLND_RX_MSGS(conn) * sizeof(struct kib_rx));
}

- if (conn->ibc_connvars)
- kfree(conn->ibc_connvars);
+ kfree(conn->ibc_connvars);

if (conn->ibc_hdev)
kiblnd_hdev_decref(conn->ibc_hdev);
\
 
 \ /
  Last update: 2017-12-21 10:42    [W:0.157 / U:2.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site