mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: ZhaoJinming <zhaojinming@uniontech.com>
Cc: horms@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org,
	linux-kernel@vger.kernel.org, madalin.bucur@nxp.com,
	netdev@vger.kernel.org, pabeni@redhat.com,
	sean.anderson@linux.dev
Subject: Re: [PATCH v2 1/2] net: fman: fix clk reference leak in read_dts_node()
Date: Mon, 22 Jun 2026 12:33:24 +0200	[thread overview]
Message-ID: <daeff8c2-9c1f-4d02-9bce-649c2fba74e8@lunn.ch> (raw)
In-Reply-To: <20260622090505.2418478-1-zhaojinming@uniontech.com>

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

      parent reply	other threads:[~2026-06-22 10:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18  7:54 [PATCH] net: fman: fix clock and device node leak in probe error paths ZhaoJinming
2026-06-18  8:08 ` Madalin Bucur
2026-06-19 12:13 ` Simon Horman
2026-06-22  9:05   ` [PATCH v2 1/2] net: fman: fix clk reference leak in read_dts_node() ZhaoJinming
2026-06-22  9:05     ` [PATCH v2 2/2] net: fman: use devm_kzalloc() for fman and rely on devres ZhaoJinming
2026-06-22 10:36       ` Andrew Lunn
2026-06-23  6:16         ` 赵金明
2026-06-23 11:22           ` Andrew Lunn
2026-06-24  9:49             ` ZhaoJinming
2026-06-24  9:49               ` [PATCH v3] net: fman: fix use-after-free on IRQF_SHARED handler after probe failure ZhaoJinming
2026-06-25 16:42                 ` Simon Horman
2026-06-26  9:53                   ` 赵金明
2026-06-26 16:23                     ` Simon Horman
2026-06-22 10:33     ` Andrew Lunn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=daeff8c2-9c1f-4d02-9bce-649c2fba74e8@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madalin.bucur@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.anderson@linux.dev \
    --cc=zhaojinming@uniontech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox