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.natara...@amd.com>
Signed-off-by: Fengguang Wu <fengguang...@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;
 }
 

Reply via email to