Skip to contentSkip to conversation

usb: musb: omap2430: Propagate PHY errors from runtime resume

PATCH In review Pengpeng Hou 1 participant 1 message Sep 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 usb: musb: omap2430: Propagate PHY errors from runtime resume

omap2430_runtime_resume() ignores phy_init() and phy_power_on() failures and continues to initialize the glue state without a usable PHY.

Return initialization errors and call phy_exit() when power-on fails after a successful initialization. Keep is_runtime_suspended set until the PHY and glue state have both been restored.

The issue was found by our static-analysis tool and manually reviewed.

Fixes 10ac7e7757f5 ("usb: musb: omap2430: Add support for idling phy when musb is idle")
Assisted-by gpt 5
---
 drivers/usb/musb/omap2430.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/musb/omap2430.c +10 -2
index 52fcbd209c66..f881455a1a23 100644
@@ -514,13 +514,21 @@ static int omap2430_runtime_resume(struct device *dev)
 {
 	struct omap2430_glue		*glue = dev_get_drvdata(dev);
 	struct musb			*musb = glue_to_musb(glue);
+	int ret;
 
 	if (!musb)
 		return 0;
 
 	if (!glue->phy_suspended) {
-		phy_init(musb->phy);
-		phy_power_on(musb->phy);
+		ret = phy_init(musb->phy);
+		if (ret)
+			return ret;
+
+		ret = phy_power_on(musb->phy);
+		if (ret) {
+			phy_exit(musb->phy);
+			return ret;
+		}
 	}
 
 	omap2430_low_level_init(musb);
Signature · 1 line
2.50.1 (Apple Git-155)