[bug report] perf: Add driver for Arm NI-700 interconnect PMU
Robin Murphy
robin.murphy at arm.com
Wed Sep 11 05:25:43 PDT 2024
On 2024-09-11 8:35 am, Dan Carpenter wrote:
> 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.
Hmm, this was just following the same pattern as every other PMU driver,
which dates all the way back to the original multi-instance
implementation[1]. Seems like one for a tree-wide cleanup if anyone's
sufficiently bothered.
Thanks,
Robin.
[1]
https://lore.kernel.org/all/1471024183-12666-1-git-send-email-bigeasy@linutronix.de/
>
> --> 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