aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/perf
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2015-10-12 14:48:39 +0100
committerArnd Bergmann <arnd@arndb.de>2015-10-15 17:11:23 +0200
commitfb659882cc6482bd2e32ec0ab8ab7afeda649413 (patch)
tree2ae37a845f1964b8b89fdf8e5dfd90233cd8a142 /drivers/perf
parentbus: arm-ccn: Fix irq affinity setting on CPU migration (diff)
downloadlinux-dev-fb659882cc6482bd2e32ec0ab8ab7afeda649413.tar.xz
linux-dev-fb659882cc6482bd2e32ec0ab8ab7afeda649413.zip
drivers/perf: arm_pmu: avoid CPU device_node reference leak
of_cpu_device_node_get increments the reference count on the CPU device_node, so we must take care to of_node_put once we've finished with it. This patch fixes the perf IRQ probing code to avoid the leak. Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/perf')
-rw-r--r--drivers/perf/arm_pmu.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 2365a32a595e..be3755c973e9 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -823,9 +823,15 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
}
/* Now look up the logical CPU number */
- for_each_possible_cpu(cpu)
- if (dn == of_cpu_device_node_get(cpu))
+ for_each_possible_cpu(cpu) {
+ struct device_node *cpu_dn;
+
+ cpu_dn = of_cpu_device_node_get(cpu);
+ of_node_put(cpu_dn);
+
+ if (dn == cpu_dn)
break;
+ }
if (cpu >= nr_cpu_ids) {
pr_warn("Failed to find logical CPU for %s\n",