mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Wentao Liang <vulab@iscas.ac.cn>, <daniel.lezcano@kernel.org>
Cc: <lee@kernel.org>, <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <tglx@kernel.org>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH] clocksource/drivers/st_lpc: Fix clock reference leaks
Date: Tue, 15 Sep 2026 11:28:39 +0200	[thread overview]
Message-ID: <cce8b6fb-eeb8-427e-b002-38ec6e8c9e60@foss.st.com> (raw)
In-Reply-To: <20260915054804.1729741-1-vulab@iscas.ac.cn>



On 9/15/26 07:48, Wentao Liang wrote:
> st_clksrc_setup_clk() obtains the LPC clock with of_clk_get() but
> leaks the consumer reference on two error paths: the
> clk_prepare_enable() failure path returns without any release, and the
> clk_get_rate() == 0 path only does clk_disable_unprepare() without
> clk_put().
> 
> Add the missing clk_put() calls, mirroring the release already done in
> st_clksrc_of_register() error handling.
> 
> Fixes: 70bef01c0f1c ("clocksource: sti: Provide support for the ST LPC Clocksource IP")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/clocksource/clksrc_st_lpc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clocksource/clksrc_st_lpc.c b/drivers/clocksource/clksrc_st_lpc.c
> index 419a886876e4..574b966eeb34 100644
> --- a/drivers/clocksource/clksrc_st_lpc.c
> +++ b/drivers/clocksource/clksrc_st_lpc.c
> @@ -74,12 +74,14 @@ static int __init st_clksrc_setup_clk(struct device_node *np)
>  
>  	if (clk_prepare_enable(clk)) {
>  		pr_err("clksrc-st-lpc: Failed to enable LPC clock\n");
> +		clk_put(clk);
>  		return -EINVAL;
>  	}
>  
>  	if (!clk_get_rate(clk)) {
>  		pr_err("clksrc-st-lpc: Failed to get LPC clock rate\n");
>  		clk_disable_unprepare(clk);
> +		clk_put(clk);
>  		return -EINVAL;
>  	}
>  


Hi Haotian

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

      reply	other threads:[~2026-09-15  9:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  5:48 Wentao Liang
2026-09-15  9:28 ` Patrice CHOTARD [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=cce8b6fb-eeb8-427e-b002-38ec6e8c9e60@foss.st.com \
    --to=patrice.chotard@foss.st.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@kernel.org \
    --cc=vulab@iscas.ac.cn \
    /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

all inboxes | Powered by JetHome®