[bug report] perf: Add driver for Arm NI-700 interconnect PMU

Dan Carpenter dan.carpenter at linaro.org
Wed Sep 11 00:35:23 PDT 2024


Hello Robin Murphy,

Commit 4d5a7680f2b4 ("perf: Add driver for Arm NI-700 interconnect
PMU") from Sep 4, 2024 (linux-next), leads to the following Smatch
static checker warning:

drivers/perf/arm-ni.c:726 arm_ni_pmu_online_cpu() warn: 'cd' was set to NULL
drivers/perf/arm-ni.c:738 arm_ni_pmu_offline_cpu() warn: 'cd' was set to NULL

drivers/perf/arm-ni.c
    719 static int arm_ni_pmu_online_cpu(unsigned int cpu, struct hlist_node *cpuhp_node)
    720 {
    721         struct arm_ni_cd *cd;
    722         int node;
    723 
    724         cd = hlist_entry_safe(cpuhp_node, struct arm_ni_cd, cpuhp_node);
    725         node = dev_to_node(cd_to_ni(cd)->dev);

There isn't any point in using the _safe() version of hlist_entry() unless we're
going to check for NULL.

--> 726         if (cpu_to_node(cd->cpu) != node && cpu_to_node(cpu) == node)
    727                 arm_ni_pmu_migrate(cd, cpu);
    728         return 0;
    729 }

regards,
dan carpenter



More information about the linux-arm-kernel mailing list