mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-14 14:34:28 +08:00
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: Pawel Moll <pawel.moll@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:
parent
bce34d1442
commit
e5a2132764
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user