Skip to contentSkip to conversation

usb: musb: omap2430: Propagate PHY errors from init

PATCH In review Pengpeng Hou 1 participant 1 message Sep 6

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

PATCH 1/3 usb: musb: omap2430: Propagate PHY errors from init

omap2430_musb_init() ignores phy_init() and phy_power_on() failures and continues to access the glue registers.

Return an initialization error before touching those registers. If power-on fails after a successful initialization, exit the PHY before returning.

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

Fixes 3e3101d57c50 ("usb: musb: omap2430: use the new generic PHY framework")
Assisted-by gpt 5
---
 drivers/usb/musb/omap2430.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/usb/musb/omap2430.c +9 -2
index 6e749faac33c..52fcbd209c66 100644
@@ -222,8 +222,15 @@ static int omap2430_musb_init(struct musb *musb)
 		return PTR_ERR(musb->phy);
 	}
 	musb->isr = omap2430_musb_interrupt;
-	phy_init(musb->phy);
-	phy_power_on(musb->phy);
+	status = phy_init(musb->phy);
+	if (status)
+		return status;
+
+	status = phy_power_on(musb->phy);
+	if (status) {
+		phy_exit(musb->phy);
+		return status;
+	}
 
 	l = musb_readl(musb->mregs, OTG_INTERFSEL);
 
Signature · 1 line
2.50.1 (Apple Git-155)