Re: [PATCH 4/6] clocksource/drivers/davinci: Fix clock reference leak in of_davinci_timer_register

From: Wentao Liang

Date: Tue Sep 15 2026 - 05:41:19 EST


On Tue, 15 Sep 2026 07:55:06 +0200, Bartosz Golaszewski <brgl@xxxxxxxxxx> said:
> I'm not following. If we keep the clock enabled, we must keep the reference. We
> just never disable it anywhere, so you correctly don't see the clk_put() in
> success path.

Hi Bart,

Thanks for taking a look. Let me clarify the point about ownership:
prepare/enable state is tracked on struct clk_core and is orthogonal to
the consumer reference. clk_put() merely unlinks the consumer and drops
the kref on the core clock (see __clk_put() in drivers/clk/clk.c) -- it
neither disables nor unprepares the clock. So releasing the reference
does not change the clock's state; the timer clock stays enabled for the
lifetime of the system either way. This is the same reasoning used by
callers that enable a clock and then put the consumer handle.

That said, I do understand the convention for these early boot timers
that are never disabled -- dw_apb_timer_of, timer-owl and asm9260_timer
also keep (or simply never put) the reference on success. If you consider
the reference intentionally retained as a subsystem convention, I'm fine
with dropping this patch; alternatively I could send a version that only
adds a comment documenting the intent. Please let me know which you
prefer.

Best regards,
Wentao Liang