Linux USB
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: cdns3 fixes for usb-linus
@ 2026-05-13  8:53 Peter Chen
  2026-05-13  8:53 ` [PATCH 1/2] usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure Peter Chen
  2026-05-13  8:53 ` [PATCH 2/2] usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles Peter Chen
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Chen @ 2026-05-13  8:53 UTC (permalink / raw)
  To: gregkh, pawell, rogerq; +Cc: linux-usb, Peter Chen

Two fixes reported by sashiko-bot@kernel.org.

Peter Chen (2):
  usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy
    acquisition failure
  usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently
    leaks the runtime PM usage counter across bind/unbind cycles

 drivers/usb/cdns3/cdns3-plat.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure
  2026-05-13  8:53 [PATCH 0/2] usb: cdns3 fixes for usb-linus Peter Chen
@ 2026-05-13  8:53 ` Peter Chen
  2026-05-13  8:53 ` [PATCH 2/2] usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles Peter Chen
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Chen @ 2026-05-13  8:53 UTC (permalink / raw)
  To: gregkh, pawell, rogerq; +Cc: linux-usb, Peter Chen, stable, sashiko-bot

Move usb2_phy initialization after usb3_phy acquisition.

Fixes: f738957277ba ("usb: cdns3: Split core.c into cdns3-plat and core.c file")
Cc: <stable@vger.kernel.org>
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-devicetree/agKaEePSFknhDBg2@nchen-desktop/T/#m21e1d9c1574eb127ce03c0c2a1a49002ce435b52
Signed-off-by: Peter Chen <peter.chen@cixtech.com>
---
 drivers/usb/cdns3/cdns3-plat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/cdns3/cdns3-plat.c b/drivers/usb/cdns3/cdns3-plat.c
index 735df88774e4..d2e8d1e9007b 100644
--- a/drivers/usb/cdns3/cdns3-plat.c
+++ b/drivers/usb/cdns3/cdns3-plat.c
@@ -126,15 +126,15 @@ static int cdns3_plat_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(cdns->usb2_phy),
 				     "Failed to get cdn3,usb2-phy\n");
 
-	ret = phy_init(cdns->usb2_phy);
-	if (ret)
-		return ret;
-
 	cdns->usb3_phy = devm_phy_optional_get(dev, "cdns3,usb3-phy");
 	if (IS_ERR(cdns->usb3_phy))
 		return dev_err_probe(dev, PTR_ERR(cdns->usb3_phy),
 				     "Failed to get cdn3,usb3-phy\n");
 
+	ret = phy_init(cdns->usb2_phy);
+	if (ret)
+		return ret;
+
 	ret = phy_init(cdns->usb3_phy);
 	if (ret)
 		goto err_phy3_init;
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles
  2026-05-13  8:53 [PATCH 0/2] usb: cdns3 fixes for usb-linus Peter Chen
  2026-05-13  8:53 ` [PATCH 1/2] usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure Peter Chen
@ 2026-05-13  8:53 ` Peter Chen
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Chen @ 2026-05-13  8:53 UTC (permalink / raw)
  To: gregkh, pawell, rogerq; +Cc: linux-usb, Peter Chen, stable, sashiko-bot

Call pm_runtime_allow(dev) conditionally at cdns3_plat_remove.

Fixes: f738957277ba ("usb: cdns3: Split core.c into cdns3-plat and core.c file")
Cc: <stable@vger.kernel.org>
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-devicetree/agKaEePSFknhDBg2@nchen-desktop/T/#m21e1d9c1574eb127ce03c0c2a1a49002ce435b52
Signed-off-by: Peter Chen <peter.chen@cixtech.com>
---
 drivers/usb/cdns3/cdns3-plat.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/cdns3/cdns3-plat.c b/drivers/usb/cdns3/cdns3-plat.c
index d2e8d1e9007b..94e9706a1806 100644
--- a/drivers/usb/cdns3/cdns3-plat.c
+++ b/drivers/usb/cdns3/cdns3-plat.c
@@ -186,6 +186,9 @@ static void cdns3_plat_remove(struct platform_device *pdev)
 	struct device *dev = cdns->dev;
 
 	pm_runtime_get_sync(dev);
+	if (!(cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW)))
+		pm_runtime_allow(dev);
+
 	pm_runtime_disable(dev);
 	pm_runtime_put_noidle(dev);
 	cdns_remove(cdns);
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-13  8:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13  8:53 [PATCH 0/2] usb: cdns3 fixes for usb-linus Peter Chen
2026-05-13  8:53 ` [PATCH 1/2] usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure Peter Chen
2026-05-13  8:53 ` [PATCH 2/2] usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox