Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1557439

[PATCH] perf/x86/amd/uncore: fix ifnullfree.cocci warnings

From kbuild test robot <lkp@intel.com>
Newsgroups linux.kernel
Subject [PATCH] perf/x86/amd/uncore: fix ifnullfree.cocci warnings
Date 2017-01-12 14:20 +0100
Message-ID <sYNsm-4qh-31@gated-at.bofh.it> (permalink)
References <sYNsm-4qh-33@gated-at.bofh.it> <sYJRM-2er-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


arch/x86/events/amd/uncore.c:365: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

CC: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

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

--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -361,8 +361,7 @@ static void amd_uncore_cpu_up_nb_free(un
 	struct amd_uncore *uncore_nb;
 
 	uncore_nb = *per_cpu_ptr(amd_uncore_nb, cpu);
-	if (uncore_nb)
-		kfree(uncore_nb);
+	kfree(uncore_nb);
 	*per_cpu_ptr(amd_uncore_nb, cpu) = NULL;
 }
 

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] perf/x86/amd/uncore: fix ifnullfree.cocci warnings kbuild test robot <lkp@intel.com> - 2017-01-12 14:20 +0100

csiph-web