* [PATCH] xtensa: kernel: Fix refcount leak bug in time.c
@ 2022-06-17 12:44 Liang He
2022-06-18 22:02 ` Max Filippov
0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-17 12:44 UTC (permalink / raw)
To: chris, jcmvbkbc; +Cc: windhl, linux-xtensa, linux-kernel
In calibrate_ccount(), of_find_compatible_node() will return a node
pointer with refcount incremented. We should use of_node_put() when
it is not used anymore.
Signed-off-by: Liang He <windhl@126.com>
---
arch/xtensa/kernel/time.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index e8ceb1528608..16b8a6273772 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -154,6 +154,7 @@ static void __init calibrate_ccount(void)
cpu = of_find_compatible_node(NULL, NULL, "cdns,xtensa-cpu");
if (cpu) {
clk = of_clk_get(cpu, 0);
+ of_node_put(cpu);
if (!IS_ERR(clk)) {
ccount_freq = clk_get_rate(clk);
return;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xtensa: kernel: Fix refcount leak bug in time.c
2022-06-17 12:44 [PATCH] xtensa: kernel: Fix refcount leak bug in time.c Liang He
@ 2022-06-18 22:02 ` Max Filippov
0 siblings, 0 replies; 2+ messages in thread
From: Max Filippov @ 2022-06-18 22:02 UTC (permalink / raw)
To: Liang He; +Cc: Chris Zankel, open list:TENSILICA XTENSA PORT (xtensa), LKML
On Fri, Jun 17, 2022 at 5:44 AM Liang He <windhl@126.com> wrote:
>
> In calibrate_ccount(), of_find_compatible_node() will return a node
> pointer with refcount incremented. We should use of_node_put() when
> it is not used anymore.
>
> Signed-off-by: Liang He <windhl@126.com>
> ---
> arch/xtensa/kernel/time.c | 1 +
> 1 file changed, 1 insertion(+)
Thanks. Applied to my xtensa tree.
-- Max
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-18 22:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 12:44 [PATCH] xtensa: kernel: Fix refcount leak bug in time.c Liang He
2022-06-18 22:02 ` Max Filippov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.