Commit e5a21327 authored by Will Deacon's avatar Will Deacon

ARM: perf: check that we have a platform device when reserving PMU

Attempting to use a hardware counter on a platform with a supported PMU
but where the platform_device (defining the interrupts) has not been
registered results in a NULL pointer dereference.

This patch fixes the problem by checking that we actually have a platform
device registered before attempting to grab the interrupts.
Reported-by: default avatarPawel Moll <pawel.moll@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent bce34d14
......@@ -402,6 +402,9 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu)
int i, err, irq, irqs;
struct platform_device *pmu_device = armpmu->plat_device;
if (!pmu_device)
return -ENODEV;
err = reserve_pmu(armpmu->type);
if (err) {
pr_warning("unable to reserve pmu\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment