Thread (14 messages) 14 messages, 4 authors, 10d ago

Re: [PATCH v2 1/2] net: fman: fix clk reference leak in read_dts_node()

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-06-22 10:33:39
Also in: lkml

On Mon, Jun 22, 2026 at 05:05:04PM +0800, ZhaoJinming wrote:
of_clk_get() returns a reference that must be released with clk_put()
when the clock is no longer needed. The current code never calls
clk_put(clk), leaking the reference on both the success path and the
clk_rate == 0 error path.

Add clk_put(clk) after the clock rate is consumed on the success path,
and jump to a new clk_put label on the error path to properly release
the clock reference.
"When the clock is no longer needed": So once you know the rate the
clock ticks at, you no longer need the clock? It is O.K. for it to
disappear, since there is no reference to it?

    Andrew

---
pw-bot: cr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help