* [PATCH] clocksource/drivers/owl: fix refcount leak
@ 2026-05-21 4:19 Alexander A. Klimov
2026-05-21 12:10 ` Markus Elfring
0 siblings, 1 reply; 4+ messages in thread
From: Alexander A. Klimov @ 2026-05-21 4:19 UTC (permalink / raw)
To: Daniel Lezcano, Thomas Gleixner, Andreas Färber,
Manivannan Sadhasivam, open list:CLOCKSOURCE, CLOCKEVENT DRIVERS,
moderated list:ARM/ACTIONS SEMI ARCHITECTURE,
moderated list:ARM/ACTIONS SEMI ARCHITECTURE
Cc: Alexander A. Klimov
Every value returned from of_clk_get() is supposed to be cleaned up
via clk_put() once not needed anymore.
Fixes: 4be78a86c506 ("clocksource: Add Owl timer")
Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
---
drivers/clocksource/timer-owl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clocksource/timer-owl.c b/drivers/clocksource/timer-owl.c
index ac97420bfa7c..fa347f430563 100644
--- a/drivers/clocksource/timer-owl.c
+++ b/drivers/clocksource/timer-owl.c
@@ -142,6 +142,7 @@ static int __init owl_timer_init(struct device_node *node)
}
rate = clk_get_rate(clk);
+ clk_put(clk);
owl_timer_reset(owl_clksrc_base);
owl_timer_set_enabled(owl_clksrc_base, true);
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] clocksource/drivers/owl: fix refcount leak
2026-05-21 4:19 [PATCH] clocksource/drivers/owl: fix refcount leak Alexander A. Klimov
@ 2026-05-21 12:10 ` Markus Elfring
2026-05-22 18:20 ` Alexander A. Klimov
0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2026-05-21 12:10 UTC (permalink / raw)
To: Alexander A. Klimov, linux-actions, linux-arm-kernel,
Andreas Färber, Daniel Lezcano, Manivannan Sadhasivam,
Thomas Gleixner
Cc: LKML
> Every value returned from of_clk_get() is supposed to be cleaned up
> via clk_put() once not needed anymore.
How do you think about to add a wording like “Thus add a missing function call.”?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.1-rc4#n94
Would the application of another guard become helpful?
How will chances evolve to adjust variable scopes accordingly?
https://elixir.bootlin.com/linux/v7.1-rc4/source/drivers/clocksource/timer-owl.c#L116-L173
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clocksource/drivers/owl: fix refcount leak
2026-05-21 12:10 ` Markus Elfring
@ 2026-05-22 18:20 ` Alexander A. Klimov
2026-05-22 19:25 ` Markus Elfring
0 siblings, 1 reply; 4+ messages in thread
From: Alexander A. Klimov @ 2026-05-22 18:20 UTC (permalink / raw)
To: Markus Elfring, linux-actions, linux-arm-kernel,
Andreas Färber, Daniel Lezcano, Manivannan Sadhasivam,
Thomas Gleixner
Cc: LKML
On 5/21/26 14:10, Markus Elfring wrote:
>> Every value returned from of_clk_get() is supposed to be cleaned up
>> via clk_put() once not needed anymore.
>
> How do you think about to add a wording like “Thus add a missing function call.”?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.1-rc4#n94
>
> Would the application of another guard become helpful?
TIL (from you) there's DEFINE_FREE.
This seems pretty cool on its own.
I think I can apply it here, but I'd have to recompile.
This takes long.
Or we just fix this leak with the oneliner
I already compiled, booted and submitted.
I'll wait what maintainers decide...
>
> How will chances evolve to adjust variable scopes accordingly?
Is this even a thing in Linux?
I mean specifying C variables anywhere ex. at function begin.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: clocksource/drivers/owl: fix refcount leak
2026-05-22 18:20 ` Alexander A. Klimov
@ 2026-05-22 19:25 ` Markus Elfring
0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2026-05-22 19:25 UTC (permalink / raw)
To: Alexander A. Klimov, linux-actions, linux-arm-kernel,
Andreas Färber, Daniel Lezcano, Manivannan Sadhasivam,
Thomas Gleixner
Cc: LKML, kernel-janitors
>> How will chances evolve to adjust variable scopes accordingly?
>
> Is this even a thing in Linux?
> I mean specifying C variables anywhere ex. at function begin.
Development views are evolving also together with the application of scope-based
resource management, aren't they?
https://elixir.bootlin.com/linux/v7.1-rc4/source/include/linux/cleanup.h#L136-L153
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-22 19:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-21 4:19 [PATCH] clocksource/drivers/owl: fix refcount leak Alexander A. Klimov
2026-05-21 12:10 ` Markus Elfring
2026-05-22 18:20 ` Alexander A. Klimov
2026-05-22 19:25 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®