From: Felix Gu <ustc.gu@gmail.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Roger Quadros <rogerq@ti.com>, Felipe Balbi <balbi@kernel.org>
Cc: linux-usb@vger.kernel.org, Felix Gu <ustc.gu@gmail.com>
Subject: [PATCH] usb: dwc3: keystone: Fix PHY runtime PM leak on probe errors
Date: Sun, 22 Nov 2026 23:15:11 +0800 [thread overview]
Message-ID: <20261122-keystone-v1-1-66f8e907685e@gmail.com> (raw)
The phy_reset(), phy_init(), and phy_power_on() error paths returned
without balancing phy_pm_runtime_get_sync(), leaking the PHY runtime PM
usage count.
Route these failures through the common cleanup path so
phy_pm_runtime_put_sync() is always called.
Fixes: 1c11e74e9079 ("usb: dwc3: keystone: Turn on USB3 PHY before controller")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/usb/dwc3/dwc3-keystone.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
index 7a5fc8545d4b..7e026f52a823 100644
--- a/drivers/usb/dwc3/dwc3-keystone.c
+++ b/drivers/usb/dwc3/dwc3-keystone.c
@@ -108,20 +108,19 @@ static int kdwc3_probe(struct platform_device *pdev)
error = phy_reset(kdwc->usb3_phy);
if (error < 0) {
dev_err(dev, "usb3 phy reset failed: %d\n", error);
- return error;
+ goto err_put_sync;
}
error = phy_init(kdwc->usb3_phy);
if (error < 0) {
dev_err(dev, "usb3 phy init failed: %d\n", error);
- return error;
+ goto err_put_sync;
}
error = phy_power_on(kdwc->usb3_phy);
if (error < 0) {
dev_err(dev, "usb3 phy power on failed: %d\n", error);
- phy_exit(kdwc->usb3_phy);
- return error;
+ goto err_phy_exit;
}
pm_runtime_enable(kdwc->dev);
@@ -164,7 +163,9 @@ static int kdwc3_probe(struct platform_device *pdev)
pm_runtime_put_sync(kdwc->dev);
pm_runtime_disable(kdwc->dev);
phy_power_off(kdwc->usb3_phy);
+err_phy_exit:
phy_exit(kdwc->usb3_phy);
+err_put_sync:
phy_pm_runtime_put_sync(kdwc->usb3_phy);
return error;
---
base-commit: adcad7f4e6332cff3d6d7165f41584899f598534
change-id: 20261122-keystone-3da0092b0f37
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
next reply other threads:[~2026-11-22 15:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 15:15 Felix Gu [this message]
2026-11-22 15:18 ` [PATCH] usb: dwc3: keystone: Fix PHY runtime PM leak on probe errors sashiko-bot
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=20261122-keystone-v1-1-66f8e907685e@gmail.com \
--to=ustc.gu@gmail.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=rogerq@ti.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