diff mbox

fix ifnullfree.cocci warnings

Message ID 20170213073119.GA17037@lkp-nex06.lkp.intel.com
State New, archived
Headers show

Commit Message

kbuild test robot Feb. 13, 2017, 7:31 a.m. UTC
fs/jbd2/jmap.c:19:2-20: 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: Abutalib Aghayev <agayev@cs.cmu.edu>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 jmap.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox

Patch

--- a/fs/jbd2/jmap.c
+++ b/fs/jbd2/jmap.c
@@ -15,8 +15,7 @@  int jbd2_journal_init_jmap_cache(void)
 
 void jbd2_journal_destroy_jmap_cache(void)
 {
-	if (jbd2_jmap_cache)
-		kmem_cache_destroy(jbd2_jmap_cache);
+	kmem_cache_destroy(jbd2_jmap_cache);
 	jbd2_jmap_cache = NULL;
 }