mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] usb: musb: omap2430: Propagate PHY errors from init
@ 2026-09-06  3:41 Pengpeng Hou
  0 siblings, 0 replies; only message in thread
From: Pengpeng Hou @ 2026-09-06  3:41 UTC (permalink / raw)
  To: Bin Liu, Greg Kroah-Hartman
  Cc: Pengpeng Hou, Sylwester Nawrocki, Kishon Vijay Abraham I,
	Felipe Balbi, linux-usb, linux-omap, linux-kernel

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
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
 drivers/usb/musb/omap2430.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 6e749faac33c..52fcbd209c66 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -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);
 
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-06  3:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-06  3:41 [PATCH 1/3] usb: musb: omap2430: Propagate PHY errors from init Pengpeng Hou

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

all inboxes | Powered by JetHome®