From: Manivannan Sadhasivam <mani@kernel.org>
To: Xia Yan <yanxia@cmss.chinamobile.com>
Cc: vkoul@kernel.org, linux-phy@lists.infradead.org,
neil.armstrong@linaro.org, mani@kernel.org, heiko@sntech.de,
p.zabel@pengutronix.de, ayaka@soulik.info, kishon@kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
yana06070@163.com
Subject: Re: [PATCH] phy: rockchip-usb: fix reset control leak
Date: Fri, 27 Nov 2026 19:28:07 +0530 [thread overview]
Message-ID: <179578788741.13164.8538367481844332594.b4-reply@b4> (raw)
In-Reply-To: <20261115042640.426517-1-yanxia@cmss.chinamobile.com>
On 2026-11-15 12:26 +0800, Xia Yan wrote:
> rockchip_usb_phy_init() acquires a reset control from each PHY child
> node but never releases it on probe failure or driver detach.
>
> The leaked exclusive control prevents a later probe from acquiring
> the same reset. Since lookup errors are converted to NULL, subsequent
> PHY reset calls silently skip the hardware reset.
>
> Register a devres action after a successful lookup to release the
> control on probe failure and detach. Keep the child-node lookup and
> the existing handling of lookup errors.
>
> Found during review of reset-control lifetimes.
>
> Fixes: 0f74ab59ce87 ("phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup")
> Cc: stable@vger.kernel.org
Stop CCing stable list for these minor fixes, please.
> Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
> ---
> drivers/phy/rockchip/phy-rockchip-usb.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-usb.c b/drivers/phy/rockchip/phy-rockchip-usb.c
> index c5a2853a63d3..79b3315b6590 100644
> --- a/drivers/phy/rockchip/phy-rockchip-usb.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usb.c
> @@ -183,6 +183,11 @@ static const struct phy_ops ops = {
> .owner = THIS_MODULE,
> };
>
> +static void rockchip_usb_phy_reset_put(void *data)
> +{
> + reset_control_put(data);
> +}
> +
> static void rockchip_usb_phy_action(void *data)
> {
> struct rockchip_usb_phy *rk_phy = data;
> @@ -219,8 +224,15 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
> }
>
> rk_phy->reset = of_reset_control_get(child, "phy-reset");
> - if (IS_ERR(rk_phy->reset))
> + if (IS_ERR(rk_phy->reset)) {
> rk_phy->reset = NULL;
> + } else {
> + err = devm_add_action_or_reset(base->dev,
> + rockchip_usb_phy_reset_put,
> + rk_phy->reset);
> + if (err)
> + return err;
> + }
Why not devm_reset_control_get()?
- Mani
next prev parent reply other threads:[~2026-11-27 13:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 4:26 Xia Yan
2026-11-27 13:58 ` Manivannan Sadhasivam [this message]
2026-12-01 8:35 ` Xia Yan
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=179578788741.13164.8538367481844332594.b4-reply@b4 \
--to=mani@kernel.org \
--cc=ayaka@soulik.info \
--cc=heiko@sntech.de \
--cc=kishon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=stable@vger.kernel.org \
--cc=vkoul@kernel.org \
--cc=yana06070@163.com \
--cc=yanxia@cmss.chinamobile.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
all inboxes | Powered by JetHome®