aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2011-06-14 10:41:04 +0100
committerNicolas Pitre <nicolas.pitre@linaro.org>2011-06-14 15:24:35 -0400
commitbdba34d3979d59cfcff6097f2f94d4fa1248be76 (patch)
tree42fc5fbfb3dd7f9d2f5dd746963fff51551adcd4
parent5983da7c49e7324808c5ebef8b03428ddcdf9e9a (diff)
downloadlinux-linaro-android-bdba34d3979d59cfcff6097f2f94d4fa1248be76.tar.gz
Fix NULL-dereference introduced by OMAP4 PMU patch
This patch fixes a NULL-dereference introduced by commit 457520e ("arm: pmu: support pmu/perf on OMAP4"). Some platforms (e.g. vexpress) neither need nor have an instance of arm_pmu_platdata (plat). Perf support on these platforms was broken by the original commit. This patch adds a check for plat before dereferencing any fields. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Avik Sil <avik.sil@linaro.org> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
-rw-r--r--arch/arm/kernel/perf_event.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 1a0d6afbb35..a734311f7a0 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -426,7 +426,7 @@ armpmu_reserve_hardware(void)
pr_warning("unable to request IRQ%d for ARM perf "
"counters\n", irq);
break;
- } else if (plat->enable_irq)
+ } else if (plat && plat->enable_irq)
plat->enable_irq(irq);
}
@@ -434,7 +434,7 @@ armpmu_reserve_hardware(void)
for (i = i - 1; i >= 0; --i) {
irq = platform_get_irq(pmu_device, i);
if (irq >= 0) {
- if (plat->disable_irq)
+ if (plat && plat->disable_irq)
plat->disable_irq(irq);
free_irq(irq, NULL);
}
@@ -456,7 +456,7 @@ armpmu_release_hardware(void)
for (i = pmu_device->num_resources - 1; i >= 0; --i) {
irq = platform_get_irq(pmu_device, i);
if (irq >= 0) {
- if (plat->disable_irq)
+ if (plat && plat->disable_irq)
plat->disable_irq(irq);
free_irq(irq, NULL);
}