mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hongling Zeng <zhongling0719@126.com>
To: Manivannan Sadhasivam <mani@kernel.org>,
	 Hongling Zeng <zenghongling@kylinos.cn>
Cc: vkoul@kernel.org, neil.armstrong@linaro.org, johan@kernel.org,
	 kishon@kernel.org, rogerq@ti.com, linux-phy@lists.infradead.org,
	 linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v6 4/4] phy: ti-pipe3: Fix clock leak in init error path
Date: Wed, 09 Sep 2026 19:16:50 +0800	[thread overview]
Message-ID: <6AA14022.6070905@126.com> (raw)
In-Reply-To: <lsywnpxioldkbvb6n7pi6uihlnofjdwrhvm7yt3qiarori4hua@c6wueslryla4>


在 2026年09月09日 15:58, Manivannan Sadhasivam 写道:
> On Fri, Jun 19, 2026 at 11:02:14AM +0800, Hongling Zeng wrote:
>> When regmap_update_bits() fails in ti_pipe3_init() for PCIe mode,
>> the function returns the error without calling ti_pipe3_disable_clocks().
>> This leaves the clocks permanently enabled since the PHY framework won't
>> invoke the .exit callback on init failure.
>>
>> Fix this by adding proper clock cleanup in the PCIe error path, consistent
>> with how the DPLL program error path handles cleanup.
>>
>> Fixes: 234738ea3390 ("phy: ti-pipe3: move clk initialization to a separate function")
>> Reported-by: Sashiko AI <sashiko@kernel.org>
>> Closes: https://lore.kernel.org/all/20260518023657.41852C2BCB0@smtp.kernel.org/
>> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
>> Cc: stable@vger.kernel.org
>>
>> ---
>> Change in v5:
>>    -Add Fix ignored clock enable return value in init patch
>> ---
>> Change in v6:
>>   -Fix all clock leak paths comprehensively:
>>   -PCIe syscon update failure path
>>   -SATA DPLL lock check path
>>   -SATA errata path in ti_pipe3_exit()
>> ---
>>   drivers/phy/ti/phy-ti-pipe3.c | 11 ++++++++---
>>   1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c
>> index 9ec228c2a940..860058f31594 100644
>> --- a/drivers/phy/ti/phy-ti-pipe3.c
>> +++ b/drivers/phy/ti/phy-ti-pipe3.c
>> @@ -518,6 +518,8 @@ static int ti_pipe3_init(struct phy *x)
>>   		val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
>>   		ret = regmap_update_bits(phy->pcs_syscon, phy->pcie_pcs_reg,
>>   					 PCIE_PCS_MASK, val);
>> +		if (ret)
>> +			ti_pipe3_disable_clocks(phy);
>>   		return ret;
>>   	}
>>   
>> @@ -531,8 +533,9 @@ static int ti_pipe3_init(struct phy *x)
>>   
>>   	/* SATA has issues if re-programmed when locked */
>>   	val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);
>> -	if ((val & PLL_LOCK) && phy->mode == PIPE3_MODE_SATA)
>> -		return ret;
>> +	if ((val & PLL_LOCK) && phy->mode == PIPE3_MODE_SATA) {
>> +		return 0;
> Why are you returning 0 here and below?
>
> - Mani
>
Hi Mani,

Thanks for pointing this out.

You're right. Changing the SATA PLL-locked path from `return ret` to
`return 0` was an unintended change and is not related to the clock leak
fix. I'll restore the original code in the next version:

     if ((val & PLL_LOCK) && phy->mode == PIPE3_MODE_SATA)
         return ret;

Thanks,
Hongling



  reply	other threads:[~2026-09-09 11:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19  3:02 [PATCH v6 0/4] phy: ti-pipe3: Fix clock resource handling issues Hongling Zeng
2026-06-19  3:02 ` [PATCH v6 1/4] phy: ti-pipe3: Fix ignored clock enable return value in init Hongling Zeng
2026-06-19  3:02 ` Hongling Zeng
2026-09-09  7:41   ` Manivannan Sadhasivam
2026-06-19  3:02 ` [PATCH v6 2/4] phy: ti: pipe3: Fix clock resource leak on probe errors Hongling Zeng
2026-06-19  3:02 ` Hongling Zeng
2026-09-09  7:49   ` Manivannan Sadhasivam
2026-06-19  3:02 ` [PATCH v6 3/4] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Hongling Zeng
2026-09-09  7:52   ` Manivannan Sadhasivam
2026-09-09 11:45     ` Hongling Zeng
2026-06-19  3:02 ` Hongling Zeng
2026-06-19  3:02 ` [PATCH v6 4/4] phy: ti-pipe3: Fix clock leak in init error path Hongling Zeng
2026-09-09  7:58   ` Manivannan Sadhasivam
2026-09-09 11:16     ` Hongling Zeng [this message]
2026-06-19  3:02 ` Hongling Zeng

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=6AA14022.6070905@126.com \
    --to=zhongling0719@126.com \
    --cc=johan@kernel.org \
    --cc=kishon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=mani@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rogerq@ti.com \
    --cc=stable@vger.kernel.org \
    --cc=vkoul@kernel.org \
    --cc=zenghongling@kylinos.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®