* [PATCH] phy: google-usb: Fix runtime PM cleanup on probe failure
@ 2026-03-16 13:11 Felix Gu
2026-05-14 15:49 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Felix Gu @ 2026-03-16 13:11 UTC (permalink / raw)
To: Peter Griffin, André Draszik, Tudor Ambarus, Vinod Koul,
Neil Armstrong, Naveen Kumar, Joy Chakraborty, Roy Luo
Cc: linux-arm-kernel, linux-samsung-soc, linux-phy, linux-kernel,
Felix Gu
In google_usb_phy_probe(), if typec_switch_register() fails,
pm_runtime_disable() is not called, leading to an unbalanced
runtime PM state on probe failure.
Switch to devm_pm_runtime_enable() to ensure that runtime PM is
automatically disabled both on probe failure and during driver
removal.
Fixes: cbce66669c82 ("phy: Add Google Tensor SoC USB PHY driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/phy/phy-google-usb.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/phy-google-usb.c b/drivers/phy/phy-google-usb.c
index ab20bc20f19e..79480f8b110e 100644
--- a/drivers/phy/phy-google-usb.c
+++ b/drivers/phy/phy-google-usb.c
@@ -251,7 +251,9 @@ static int google_usb_phy_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(phy_provider),
"failed to register phy provider\n");
- pm_runtime_enable(dev);
+ ret = devm_pm_runtime_enable(dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
sw_desc.fwnode = dev_fwnode(dev);
sw_desc.drvdata = gphy;
@@ -271,7 +273,6 @@ static void google_usb_phy_remove(struct platform_device *pdev)
struct google_usb_phy *gphy = dev_get_drvdata(&pdev->dev);
typec_switch_unregister(gphy->sw);
- pm_runtime_disable(&pdev->dev);
}
static const struct of_device_id google_usb_phy_of_match[] = {
---
base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900
change-id: 20260316-google-3acfa2f3de9d
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] phy: google-usb: Fix runtime PM cleanup on probe failure
2026-03-16 13:11 [PATCH] phy: google-usb: Fix runtime PM cleanup on probe failure Felix Gu
@ 2026-05-14 15:49 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2026-05-14 15:49 UTC (permalink / raw)
To: Felix Gu
Cc: Peter Griffin, André Draszik, Tudor Ambarus, Neil Armstrong,
Naveen Kumar, Joy Chakraborty, Roy Luo, linux-arm-kernel,
linux-samsung-soc, linux-phy, linux-kernel
On 16-03-26, 21:11, Felix Gu wrote:
> In google_usb_phy_probe(), if typec_switch_register() fails,
> pm_runtime_disable() is not called, leading to an unbalanced
> runtime PM state on probe failure.
>
> Switch to devm_pm_runtime_enable() to ensure that runtime PM is
> automatically disabled both on probe failure and during driver
> removal.
PLease see https://sashiko.dev/#/patchset/20260316-google-v1-1-30a034e87a2a%40gmail.com
>
> Fixes: cbce66669c82 ("phy: Add Google Tensor SoC USB PHY driver")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> drivers/phy/phy-google-usb.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/phy/phy-google-usb.c b/drivers/phy/phy-google-usb.c
> index ab20bc20f19e..79480f8b110e 100644
> --- a/drivers/phy/phy-google-usb.c
> +++ b/drivers/phy/phy-google-usb.c
> @@ -251,7 +251,9 @@ static int google_usb_phy_probe(struct platform_device *pdev)
> return dev_err_probe(dev, PTR_ERR(phy_provider),
> "failed to register phy provider\n");
>
> - pm_runtime_enable(dev);
> + ret = devm_pm_runtime_enable(dev);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
>
> sw_desc.fwnode = dev_fwnode(dev);
> sw_desc.drvdata = gphy;
> @@ -271,7 +273,6 @@ static void google_usb_phy_remove(struct platform_device *pdev)
> struct google_usb_phy *gphy = dev_get_drvdata(&pdev->dev);
>
> typec_switch_unregister(gphy->sw);
> - pm_runtime_disable(&pdev->dev);
> }
>
> static const struct of_device_id google_usb_phy_of_match[] = {
>
> ---
> base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900
> change-id: 20260316-google-3acfa2f3de9d
>
> Best regards,
> --
> Felix Gu <ustc.gu@gmail.com>
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-14 15:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 13:11 [PATCH] phy: google-usb: Fix runtime PM cleanup on probe failure Felix Gu
2026-05-14 15:49 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox