From: Sebastian Reichel <sebastian.reichel@collabora.com>
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, yana06070@163.com
Subject: Re: [PATCH v2] phy: rockchip-usb: fix reset control leak
Date: Wed, 2 Dec 2026 01:28:05 +0100 [thread overview]
Message-ID: <aw9loPglDzKaZI6u@venus> (raw)
In-Reply-To: <20261201082805.50160d227cb63d84.patch@cmss.chinamobile.com>
[-- Attachment #1.1: Type: text/plain, Size: 2928 bytes --]
Hi,
On Tue, Dec 01, 2026 at 04:28:05PM +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.
>
> Move the lookup after devm_phy_create() and use devm_reset_control_get()
> with the PHY device. Its firmware node is the original PHY child node,
> so this keeps the lookup on the same node and releases the control
> when the PHY device is released. Keep the existing handling of lookup
> errors.
>
> Found during review of reset-control lifetimes.
>
> Build-tested the driver object directly on x86_64 with W=1 and reset
> support enabled. No ARM or hardware testing.
>
> Fixes: 0f74ab59ce87 ("phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup")
> Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
devm_reset_control_get() is deprecated in favor of
devm_reset_control_get_exclusive(), so it makes sense to directly
use the second one.
Greetings,
-- Sebastian
>
> ---
>
> Notes (rockchip-v2-20261201):
> Changes in v2:
> - Drop the stable Cc as requested by Manivannan Sadhasivam.
> - Use devm_reset_control_get() on the PHY device after devm_phy_create(),
> replacing the custom reset_control_put() action from v1.
>
> v1: https://lore.kernel.org/linux-phy/20261115042640.426517-1-yanxia@cmss.chinamobile.com/
> Review: https://patchwork.kernel.org/comment/27414254/
>
> drivers/phy/rockchip/phy-rockchip-usb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-usb.c b/drivers/phy/rockchip/phy-rockchip-usb.c
> index c5a2853a63d3..a3adb0a01b85 100644
> --- a/drivers/phy/rockchip/phy-rockchip-usb.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usb.c
> @@ -218,10 +218,6 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
> return -EINVAL;
> }
>
> - rk_phy->reset = of_reset_control_get(child, "phy-reset");
> - if (IS_ERR(rk_phy->reset))
> - rk_phy->reset = NULL;
> -
> rk_phy->reg_offset = reg_offset;
>
> rk_phy->clk = of_clk_get_by_name(child, "phyclk");
> @@ -285,6 +281,10 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
> }
> phy_set_drvdata(rk_phy->phy, rk_phy);
>
> + rk_phy->reset = devm_reset_control_get(&rk_phy->phy->dev, "phy-reset");
> + if (IS_ERR(rk_phy->reset))
> + rk_phy->reset = NULL;
> +
> rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus");
> if (IS_ERR(rk_phy->vbus)) {
> if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER)
>
> base-commit: 9a0dd2a09484e5ba45eb8e6ab58c0effe18703a3
> --
> 2.43.0
>
>
>
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 112 bytes --]
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Reichel <sebastian.reichel@collabora.com>
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, yana06070@163.com
Subject: Re: [PATCH v2] phy: rockchip-usb: fix reset control leak
Date: Wed, 2 Dec 2026 01:28:05 +0100 [thread overview]
Message-ID: <aw9loPglDzKaZI6u@venus> (raw)
In-Reply-To: <20261201082805.50160d227cb63d84.patch@cmss.chinamobile.com>
[-- Attachment #1.1: Type: text/plain, Size: 2928 bytes --]
Hi,
On Tue, Dec 01, 2026 at 04:28:05PM +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.
>
> Move the lookup after devm_phy_create() and use devm_reset_control_get()
> with the PHY device. Its firmware node is the original PHY child node,
> so this keeps the lookup on the same node and releases the control
> when the PHY device is released. Keep the existing handling of lookup
> errors.
>
> Found during review of reset-control lifetimes.
>
> Build-tested the driver object directly on x86_64 with W=1 and reset
> support enabled. No ARM or hardware testing.
>
> Fixes: 0f74ab59ce87 ("phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup")
> Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
devm_reset_control_get() is deprecated in favor of
devm_reset_control_get_exclusive(), so it makes sense to directly
use the second one.
Greetings,
-- Sebastian
>
> ---
>
> Notes (rockchip-v2-20261201):
> Changes in v2:
> - Drop the stable Cc as requested by Manivannan Sadhasivam.
> - Use devm_reset_control_get() on the PHY device after devm_phy_create(),
> replacing the custom reset_control_put() action from v1.
>
> v1: https://lore.kernel.org/linux-phy/20261115042640.426517-1-yanxia@cmss.chinamobile.com/
> Review: https://patchwork.kernel.org/comment/27414254/
>
> drivers/phy/rockchip/phy-rockchip-usb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-usb.c b/drivers/phy/rockchip/phy-rockchip-usb.c
> index c5a2853a63d3..a3adb0a01b85 100644
> --- a/drivers/phy/rockchip/phy-rockchip-usb.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usb.c
> @@ -218,10 +218,6 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
> return -EINVAL;
> }
>
> - rk_phy->reset = of_reset_control_get(child, "phy-reset");
> - if (IS_ERR(rk_phy->reset))
> - rk_phy->reset = NULL;
> -
> rk_phy->reg_offset = reg_offset;
>
> rk_phy->clk = of_clk_get_by_name(child, "phyclk");
> @@ -285,6 +281,10 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
> }
> phy_set_drvdata(rk_phy->phy, rk_phy);
>
> + rk_phy->reset = devm_reset_control_get(&rk_phy->phy->dev, "phy-reset");
> + if (IS_ERR(rk_phy->reset))
> + rk_phy->reset = NULL;
> +
> rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus");
> if (IS_ERR(rk_phy->vbus)) {
> if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER)
>
> base-commit: 9a0dd2a09484e5ba45eb8e6ab58c0effe18703a3
> --
> 2.43.0
>
>
>
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Reichel <sebastian.reichel@collabora.com>
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, yana06070@163.com
Subject: Re: [PATCH v2] phy: rockchip-usb: fix reset control leak
Date: Wed, 2 Dec 2026 01:28:05 +0100 [thread overview]
Message-ID: <aw9loPglDzKaZI6u@venus> (raw)
In-Reply-To: <20261201082805.50160d227cb63d84.patch@cmss.chinamobile.com>
[-- Attachment #1: Type: text/plain, Size: 2928 bytes --]
Hi,
On Tue, Dec 01, 2026 at 04:28:05PM +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.
>
> Move the lookup after devm_phy_create() and use devm_reset_control_get()
> with the PHY device. Its firmware node is the original PHY child node,
> so this keeps the lookup on the same node and releases the control
> when the PHY device is released. Keep the existing handling of lookup
> errors.
>
> Found during review of reset-control lifetimes.
>
> Build-tested the driver object directly on x86_64 with W=1 and reset
> support enabled. No ARM or hardware testing.
>
> Fixes: 0f74ab59ce87 ("phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup")
> Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
devm_reset_control_get() is deprecated in favor of
devm_reset_control_get_exclusive(), so it makes sense to directly
use the second one.
Greetings,
-- Sebastian
>
> ---
>
> Notes (rockchip-v2-20261201):
> Changes in v2:
> - Drop the stable Cc as requested by Manivannan Sadhasivam.
> - Use devm_reset_control_get() on the PHY device after devm_phy_create(),
> replacing the custom reset_control_put() action from v1.
>
> v1: https://lore.kernel.org/linux-phy/20261115042640.426517-1-yanxia@cmss.chinamobile.com/
> Review: https://patchwork.kernel.org/comment/27414254/
>
> drivers/phy/rockchip/phy-rockchip-usb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-usb.c b/drivers/phy/rockchip/phy-rockchip-usb.c
> index c5a2853a63d3..a3adb0a01b85 100644
> --- a/drivers/phy/rockchip/phy-rockchip-usb.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usb.c
> @@ -218,10 +218,6 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
> return -EINVAL;
> }
>
> - rk_phy->reset = of_reset_control_get(child, "phy-reset");
> - if (IS_ERR(rk_phy->reset))
> - rk_phy->reset = NULL;
> -
> rk_phy->reg_offset = reg_offset;
>
> rk_phy->clk = of_clk_get_by_name(child, "phyclk");
> @@ -285,6 +281,10 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
> }
> phy_set_drvdata(rk_phy->phy, rk_phy);
>
> + rk_phy->reset = devm_reset_control_get(&rk_phy->phy->dev, "phy-reset");
> + if (IS_ERR(rk_phy->reset))
> + rk_phy->reset = NULL;
> +
> rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus");
> if (IS_ERR(rk_phy->vbus)) {
> if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER)
>
> base-commit: 9a0dd2a09484e5ba45eb8e6ab58c0effe18703a3
> --
> 2.43.0
>
>
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-12-02 5:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 8:28 [PATCH v2] phy: rockchip-usb: fix reset control leak Xia Yan
2026-12-01 8:28 ` Xia Yan
2026-12-01 8:28 ` Xia Yan
2026-12-02 0:28 ` Sebastian Reichel [this message]
2026-12-02 0:28 ` Sebastian Reichel
2026-12-02 0:28 ` Sebastian Reichel
2026-12-02 7:34 ` Xia Yan
2026-12-02 7:34 ` Xia Yan
2026-12-02 7:34 ` 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=aw9loPglDzKaZI6u@venus \
--to=sebastian.reichel@collabora.com \
--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=mani@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=p.zabel@pengutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.