From: Fengguang Wu <[email protected]>
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 <[email protected]>
Signed-off-by: Fengguang Wu <[email protected]>
---
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);