Skip to contentSkip to conversation

usb: musb: mediatek: don't unregister something that wasn't registered

PATCH New Dan Carpenter 1 participant 1 message Jan 24, 2023

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

PATCH 1/1 usb: musb: mediatek: don't unregister something that wasn't registered

This function only calls mtk_otg_switch_init() when the ->port_mode is MUSB_OTG so the clean up code should only call mtk_otg_switch_exit() for that mode.

Fixes 0990366bab3c ("usb: musb: Add support for MediaTek musb controller")

---
From static analysis. Please review carefully.

 drivers/usb/musb/mediatek.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/musb/mediatek.c +2 -1
index cad991380b0c..27b9bd258340 100644
@@ -294,7 +294,8 @@ static int mtk_musb_init(struct musb *musb)
 err_phy_power_on:
 	phy_exit(glue->phy);
 err_phy_init:
-	mtk_otg_switch_exit(glue);
+	if (musb->port_mode == MUSB_OTG)
+		mtk_otg_switch_exit(glue);
 	return ret;
 }
 
Signature · 1 line
2.35.1