* [bug report] perf: Add Arm CMN-600 PMU driver
@ 2020-09-30 14:34 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2020-09-30 14:34 UTC (permalink / raw)
To: robin.murphy; +Cc: linux-arm-kernel
Hello Robin Murphy,
The patch 0ba64770a2f2: "perf: Add Arm CMN-600 PMU driver" from Sep
18, 2020, leads to the following static checker warning:
drivers/perf/arm-cmn.c:1156 arm_cmn_pmu_offline_cpu()
error: potential NULL dereference 'cmn'.
drivers/perf/arm-cmn.c
1150 static int arm_cmn_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
1151 {
1152 struct arm_cmn *cmn;
1153 unsigned int target;
1154
1155 cmn = hlist_entry_safe(node, struct arm_cmn, cpuhp_node);
1156 if (cpu != cmn->cpu)
^^^^^^^^
It doesn't make sense to use hlist_entry_safe() and then dereference
"cmn" without checking for NULL. It should either be hlist_entry() or
there should be a NULL check.
1157 return 0;
1158
1159 target = cpumask_any_but(cpu_online_mask, cpu);
1160 if (target >= nr_cpu_ids)
1161 return 0;
1162
1163 perf_pmu_migrate_context(&cmn->pmu, cpu, target);
1164 cmn->cpu = target;
1165 return 0;
1166 }
regards,
dan carpenter
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [bug report] perf: Add Arm CMN-600 PMU driver
@ 2020-09-30 14:36 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2020-09-30 14:36 UTC (permalink / raw)
To: robin.murphy; +Cc: linux-arm-kernel
Hello Robin Murphy,
The patch 0ba64770a2f2: "perf: Add Arm CMN-600 PMU driver" from Sep
18, 2020, leads to the following static checker warning:
drivers/perf/arm-cmn.c:1252 arm_cmn_init_dtc()
warn: unsigned 'dtc->irq' is never less than zero.
drivers/perf/arm-cmn.c
1245 static int arm_cmn_init_dtc(struct arm_cmn *cmn, struct arm_cmn_node *dn, int idx)
1246 {
1247 struct arm_cmn_dtc *dtc = cmn->dtc + idx;
1248 struct arm_cmn_node *xp;
1249
1250 dtc->base = dn->pmu_base - CMN_PMU_OFFSET;
1251 dtc->irq = platform_get_irq(to_platform_device(cmn->dev), idx);
1252 if (dtc->irq < 0)
^^^^^^^^^^^^
"dtc->irq" is unsigned.
1253 return dtc->irq;
1254
1255 writel_relaxed(0, dtc->base + CMN_DT_PMCR);
1256 writel_relaxed(0x1ff, dtc->base + CMN_DT_PMOVSR_CLR);
regards,
dan carpenter
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-30 14:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-30 14:34 [bug report] perf: Add Arm CMN-600 PMU driver Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2020-09-30 14:36 Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).