public inbox for linux-amlogic@lists.infradead.org
 help / color / mirror / Atom feed
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
To: Haotian Zhang <vulab@iscas.ac.cn>,
	alexandre.belloni@bootlin.com, yiting.deng@amlogic.com
Cc: linux-amlogic@lists.infradead.org, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rtc: amlogic-a4: fix double free caused by devm
Date: Wed, 22 Oct 2025 13:48:02 +0800	[thread overview]
Message-ID: <126bce2b-d899-40e8-ae45-07dfd1e3f8c7@amlogic.com> (raw)
In-Reply-To: <20251021103559.1903-1-vulab@iscas.ac.cn>

Reviewed-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
On 2025/10/21 18:35, Haotian Zhang wrote:
> [Some people who received this message don't often get email from vulab@iscas.ac.cn. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> [ EXTERNAL EMAIL ]
> 
> The clock obtained via devm_clk_get_enabled() is automatically managed
> by devres and will be disabled and freed on driver detach. Manually
> calling clk_disable_unprepare() in error path and remove function
> causes double free.
> 
> Remove the redundant clk_disable_unprepare() calls from the probe
> error path and aml_rtc_remove(), allowing the devm framework to
> automatically manage the clock lifecycle.
> 
> Fixes: c89ac9182ee2 ("rtc: support for the Amlogic on-chip RTC")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---
> v2: Also remove the now-unused local variable 'rtc' in aml_rtc_remove()
> ---
>   drivers/rtc/rtc-amlogic-a4.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-amlogic-a4.c b/drivers/rtc/rtc-amlogic-a4.c
> index 1928b29c1045..a993d35e1d6b 100644
> --- a/drivers/rtc/rtc-amlogic-a4.c
> +++ b/drivers/rtc/rtc-amlogic-a4.c
> @@ -390,7 +390,6 @@ static int aml_rtc_probe(struct platform_device *pdev)
> 
>          return 0;
>   err_clk:
> -       clk_disable_unprepare(rtc->sys_clk);
>          device_init_wakeup(dev, false);
> 
>          return ret;
> @@ -423,9 +422,6 @@ static SIMPLE_DEV_PM_OPS(aml_rtc_pm_ops,
> 
>   static void aml_rtc_remove(struct platform_device *pdev)
>   {
> -       struct aml_rtc_data *rtc = dev_get_drvdata(&pdev->dev);
> -
> -       clk_disable_unprepare(rtc->sys_clk);
>          device_init_wakeup(&pdev->dev, false);
>   }
> 
> --
> 2.25.1
> 

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2025-10-22  5:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20 15:09 [PATCH] rtc: amlogic-a4: fix double free caused by devm Haotian Zhang
2025-10-21  9:29 ` kernel test robot
2025-10-21 10:35 ` [PATCH v2] " Haotian Zhang
2025-10-22  5:48   ` Xianwei Zhao [this message]
2025-10-31 23:02   ` Alexandre Belloni

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=126bce2b-d899-40e8-ae45-07dfd1e3f8c7@amlogic.com \
    --to=xianwei.zhao@amlogic.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=vulab@iscas.ac.cn \
    --cc=yiting.deng@amlogic.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