arm_pmu: acpi: handle allocation failure

One of the failure paths in the arm_pmu ACPI code is missing an early
return, permitting a NULL pointer dereference upon a memory allocation
failure.

Add the missing return.

Fixes: fe40ffdb76 ("arm_pmu: rework ACPI probing")
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reported-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20221108093725.1239563-1-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
Mark Rutland 2022-11-08 09:37:25 +00:00 committed by Will Deacon
parent fe40ffdb76
commit a8731264e5
1 changed files with 1 additions and 0 deletions

View File

@ -333,6 +333,7 @@ int arm_pmu_acpi_probe(armpmu_init_fn init_fn)
if (!pmu) { if (!pmu) {
pr_warn("Unable to allocate PMU for CPU%d\n", pr_warn("Unable to allocate PMU for CPU%d\n",
cpu); cpu);
return -ENOMEM;
} }
cpuid = per_cpu(cpu_data, cpu).reg_midr; cpuid = per_cpu(cpu_data, cpu).reg_midr;