Skip to contentSkip to conversation

usb: cdns3 fixes for usb-linus

PATCH New Peter Chen 1 participant 3 messages May 13

Subsystems (3)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

cover usb: cdns3 fixes for usb-linus

Two fixes reported by [email protected].

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(-)
Signature · 1 line
2.50.1
author
#1 lore raw

PATCH 1/2 usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure

Move usb2_phy initialization after usb3_phy acquisition.

---
 drivers/usb/cdns3/cdns3-plat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/cdns3/cdns3-plat.c +4 -4
index 735df88774e4..d2e8d1e9007b 100644
@@ -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;
Signature · 1 line
2.50.1
author
#2 lore raw

PATCH 2/2 usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles

In reply to Peter Chen

Call pm_runtime_allow(dev) conditionally at cdns3_plat_remove.

---
 drivers/usb/cdns3/cdns3-plat.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/cdns3/cdns3-plat.c +3 -0
index d2e8d1e9007b..94e9706a1806 100644
@@ -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);
Signature · 1 line
2.50.1