mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Jiawen Liu <1298662399@qq.com>, linux-kernel@vger.kernel.org
Cc: alexandre.belloni@bootlin.com
Subject: Re: [PATCH] rtc: rtc-cadence: fix clock cleanup ordering
Date: Tue, 18 Aug 2026 22:24:18 +0200	[thread overview]
Message-ID: <7739adcb-4234-4e28-a010-bcb64605b5af@wanadoo.fr> (raw)
In-Reply-To: <tencent_2EA9016EFDAA548AD4D717D94396E93A380A@qq.com>

Le 18/08/2026 à 14:41, Jiawen Liu a écrit :
> From: jiawen <1298662399@qq.com>
> 
> The probe function enables the peripheral clock (pclk) before the
> reference clock (ref_clk), and its error path disables ref_clk before
> pclk. However, the remove function disables pclk before ref_clk, which
> is the reverse order. This asymmetric teardown can leave the clock
> framework in an inconsistent state and violates the expected lifecycle
> balance. Fix the remove function to disable ref_clk first, then pclk,
> matching the probe enable order and the error path cleanup order.
> 
> Signed-off-by: jiawen <1298662399@qq.com>
> ---
> diff --git a/drivers/rtc/rtc-cadence.c b/drivers/rtc/rtc-cadence.c
> --- a/drivers/rtc/rtc-cadence.c
> +++ b/drivers/rtc/rtc-cadence.c
> @@ -361,8 +361,8 @@
>   	cdns_rtc_alarm_irq_enable(&pdev->dev, 0);
>   	device_init_wakeup(&pdev->dev, false);
>   
> +	clk_disable_unprepare(crtc->ref_clk);
>   	clk_disable_unprepare(crtc->pclk);
> -	clk_disable_unprepare(crtc->ref_clk);
>   }
>   
>   #ifdef CONFIG_PM_SLEEP
> 

Hi,
you should use ./scripts/get_maintainer.pl to identify to who the patch 
should be sent. A pmatch only sent to linux-kernel@... will be taken by 
no-one.

Personally, I use "./scripts/get_maintainer.pl --nogit --nogit-fallback 
--norolestats" to fileter even more the output.

So adding Alexandre Belloni to my reply.



Also, are you using "git format-patch" to prepare the patch to be sent? 
In my case, some more context is added after "@@ -361,8 +361,8 @@". This 
help when reviewing patches.



Concerning your patch, I think that using devm_clk_get_enabled() instead 
of devm_clk_get() in the probe would be a better option. It changes the 
same order as you do and simplify the error handling path of the probe 
and the remove function.

CJ


  reply	other threads:[~2026-08-18 20:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 12:41 Jiawen Liu
2026-08-18 20:24 ` Christophe JAILLET [this message]
2026-11-08 17:22   ` Jiawen Liu

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=7739adcb-4234-4e28-a010-bcb64605b5af@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=1298662399@qq.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®