* [PATCH] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node()
@ 2022-07-15 13:03 Liang He
2022-07-18 12:13 ` Andrew Jones
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Liang He @ 2022-07-15 13:03 UTC (permalink / raw)
To: atishp, anup, will, mark.rutland, paul.walmsley, palmer,
linux-riscv, windhl
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: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support")
Signed-off-by: Liang He <windhl@126.com>
---
drivers/perf/riscv_pmu_sbi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
index dca3537a8dcc..705d249a1b53 100644
--- a/drivers/perf/riscv_pmu_sbi.c
+++ b/drivers/perf/riscv_pmu_sbi.c
@@ -666,12 +666,15 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
child = of_get_compatible_child(cpu, "riscv,cpu-intc");
if (!child) {
pr_err("Failed to find INTC node\n");
+ of_node_put(cpu);
return -ENODEV;
}
domain = irq_find_host(child);
of_node_put(child);
- if (domain)
+ if (domain) {
+ of_node_put(cpu);
break;
+ }
}
if (!domain) {
pr_err("Failed to find INTC IRQ root domain\n");
--
2.25.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node()
2022-07-15 13:03 [PATCH] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node() Liang He
@ 2022-07-18 12:13 ` Andrew Jones
2022-07-19 16:10 ` Atish Patra
2022-07-19 19:56 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Jones @ 2022-07-18 12:13 UTC (permalink / raw)
To: Liang He
Cc: atishp, anup, will, mark.rutland, paul.walmsley, palmer,
linux-riscv
On Fri, Jul 15, 2022 at 09:03:30PM +0800, Liang He wrote:
> 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: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support")
> Signed-off-by: Liang He <windhl@126.com>
> ---
> drivers/perf/riscv_pmu_sbi.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
> index dca3537a8dcc..705d249a1b53 100644
> --- a/drivers/perf/riscv_pmu_sbi.c
> +++ b/drivers/perf/riscv_pmu_sbi.c
> @@ -666,12 +666,15 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
> child = of_get_compatible_child(cpu, "riscv,cpu-intc");
> if (!child) {
> pr_err("Failed to find INTC node\n");
> + of_node_put(cpu);
> return -ENODEV;
> }
> domain = irq_find_host(child);
> of_node_put(child);
> - if (domain)
> + if (domain) {
> + of_node_put(cpu);
> break;
> + }
> }
> if (!domain) {
> pr_err("Failed to find INTC IRQ root domain\n");
> --
> 2.25.1
>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node()
2022-07-15 13:03 [PATCH] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node() Liang He
2022-07-18 12:13 ` Andrew Jones
@ 2022-07-19 16:10 ` Atish Patra
2022-07-19 19:56 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Atish Patra @ 2022-07-19 16:10 UTC (permalink / raw)
To: Liang He
Cc: Anup Patel, will@kernel.org, mark.rutland@arm.com, Paul Walmsley,
Palmer Dabbelt, linux-riscv
On Fri, Jul 15, 2022 at 6:03 AM Liang He <windhl@126.com> wrote:
>
> 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: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support")
> Signed-off-by: Liang He <windhl@126.com>
> ---
> drivers/perf/riscv_pmu_sbi.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
> index dca3537a8dcc..705d249a1b53 100644
> --- a/drivers/perf/riscv_pmu_sbi.c
> +++ b/drivers/perf/riscv_pmu_sbi.c
> @@ -666,12 +666,15 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
> child = of_get_compatible_child(cpu, "riscv,cpu-intc");
> if (!child) {
> pr_err("Failed to find INTC node\n");
> + of_node_put(cpu);
> return -ENODEV;
> }
> domain = irq_find_host(child);
> of_node_put(child);
> - if (domain)
> + if (domain) {
> + of_node_put(cpu);
> break;
> + }
> }
> if (!domain) {
> pr_err("Failed to find INTC IRQ root domain\n");
> --
> 2.25.1
>
Thanks for catching it.
Reviewed-by: Atish Patra <atishp@rivosinc.com>
--
Regards,
Atish
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node()
2022-07-15 13:03 [PATCH] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node() Liang He
2022-07-18 12:13 ` Andrew Jones
2022-07-19 16:10 ` Atish Patra
@ 2022-07-19 19:56 ` Will Deacon
2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2022-07-19 19:56 UTC (permalink / raw)
To: anup, linux-riscv, paul.walmsley, mark.rutland, palmer, Liang He,
atishp
Cc: catalin.marinas, kernel-team, Will Deacon
On Fri, 15 Jul 2022 21:03:30 +0800, Liang He wrote:
> 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.
>
>
Applied to will (for-next/perf), thanks!
[1/1] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node()
https://git.kernel.org/will/c/491f10d08fda
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-19 19:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-15 13:03 [PATCH] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node() Liang He
2022-07-18 12:13 ` Andrew Jones
2022-07-19 16:10 ` Atish Patra
2022-07-19 19:56 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox