Skip to content

Commit 491f10d

Browse files
windhlwilldeacon
authored andcommitted
perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node()
In pmu_sbi_setup_irqs(), we should call of_node_put() for the 'cpu' when breaking out of for_each_of_cput_node() as its refcount will be automatically increased and decreased during the iteration. Fixes: 4905ec2 ("RISC-V: Add sscofpmf extension support") Signed-off-by: Liang He <[email protected]> Reviewed-by: Atish Patra <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent aaaee7b commit 491f10d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/perf/riscv_pmu_sbi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,12 +686,15 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
686686
child = of_get_compatible_child(cpu, "riscv,cpu-intc");
687687
if (!child) {
688688
pr_err("Failed to find INTC node\n");
689+
of_node_put(cpu);
689690
return -ENODEV;
690691
}
691692
domain = irq_find_host(child);
692693
of_node_put(child);
693-
if (domain)
694+
if (domain) {
695+
of_node_put(cpu);
694696
break;
697+
}
695698
}
696699
if (!domain) {
697700
pr_err("Failed to find INTC IRQ root domain\n");

0 commit comments

Comments
 (0)