ARM: 8402/1: perf: Don't use of_node after putting it
[sfrench/cifs-2.6.git] / arch / arm / kernel / perf_event.c
index 357f57ea83f4b82fe0712c7af9a06d677be34d18..54272e0be7137c853f2d684d236449157ef55193 100644 (file)
@@ -818,12 +818,13 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
                        if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL))
                                break;
 
-               of_node_put(dn);
                if (cpu >= nr_cpu_ids) {
                        pr_warn("Failed to find logical CPU for %s\n",
                                dn->name);
+                       of_node_put(dn);
                        break;
                }
+               of_node_put(dn);
 
                irqs[i] = cpu;
                cpumask_set_cpu(cpu, &pmu->supported_cpus);