diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2014-02-07 16:01:20 -0500 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2014-02-21 06:10:52 -0500 |
commit | 3a3967ed9135f931f3848b0c946dcf3c10ca9f9a (patch) | |
tree | b358c1ff9179d9e2eac6bd4bd47517e05b4a510a | |
parent | bbd64559376fa25732994c4181c8ec493fa57871 (diff) |
ARM: perf: assign pdev pointer earlier for CPU PMUs
We want to inspect the of_node that the pdev is pointing to in
the Krait CPU specific PMU initialization function. Assign it
earlier so that we don't crash with a NULL pointer dereference.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | arch/arm/kernel/perf_event_cpu.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c index 6efd8aab15df..68d02ca0ca1b 100644 --- a/arch/arm/kernel/perf_event_cpu.c +++ b/arch/arm/kernel/perf_event_cpu.c | |||
@@ -311,6 +311,9 @@ static int cpu_pmu_device_probe(struct platform_device *pdev) | |||
311 | return -ENOMEM; | 311 | return -ENOMEM; |
312 | } | 312 | } |
313 | 313 | ||
314 | cpu_pmu = pmu; | ||
315 | cpu_pmu->plat_device = pdev; | ||
316 | |||
314 | if (node && (of_id = of_match_node(cpu_pmu_of_device_ids, pdev->dev.of_node))) { | 317 | if (node && (of_id = of_match_node(cpu_pmu_of_device_ids, pdev->dev.of_node))) { |
315 | init_fn = of_id->data; | 318 | init_fn = of_id->data; |
316 | ret = init_fn(pmu); | 319 | ret = init_fn(pmu); |
@@ -323,8 +326,6 @@ static int cpu_pmu_device_probe(struct platform_device *pdev) | |||
323 | goto out_free; | 326 | goto out_free; |
324 | } | 327 | } |
325 | 328 | ||
326 | cpu_pmu = pmu; | ||
327 | cpu_pmu->plat_device = pdev; | ||
328 | cpu_pmu_init(cpu_pmu); | 329 | cpu_pmu_init(cpu_pmu); |
329 | ret = armpmu_register(cpu_pmu, PERF_TYPE_RAW); | 330 | ret = armpmu_register(cpu_pmu, PERF_TYPE_RAW); |
330 | 331 | ||