lkml.org 
[lkml]   [2017]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] perf/x86/amd/uncore: fix ifnullfree.cocci warnings
    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;
    }

    \
     
     \ /
      Last update: 2017-01-12 14:14    [W:3.569 / U:1.304 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site