* [bug report] perf: Add driver for Arm NI-700 interconnect PMU
@ 2024-09-11 7:35 Dan Carpenter
2024-09-11 12:25 ` Robin Murphy
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-09-11 7:35 UTC (permalink / raw)
To: Robin Murphy; +Cc: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] perf: Add driver for Arm NI-700 interconnect PMU
2024-09-11 7:35 [bug report] perf: Add driver for Arm NI-700 interconnect PMU Dan Carpenter
@ 2024-09-11 12:25 ` Robin Murphy
0 siblings, 0 replies; 2+ messages in thread
From: Robin Murphy @ 2024-09-11 12:25 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-11 12:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11 7:35 [bug report] perf: Add driver for Arm NI-700 interconnect PMU Dan Carpenter
2024-09-11 12:25 ` Robin Murphy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox