[PATCH 09/32] usb: dwc2: gracefully handle unknown hs_phy_type

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Sep 5 02:55:34 PDT 2022


Static analysis shows that, we may not enter the switch and thus write
an uninitialized value. Warn if we indeed reach this case and handle it
as if the register read GHWCFG2_HS_PHY_TYPE_NOT_SUPPORTED for now.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/usb/dwc2/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index 8be5c91f98a1..459ebc65372c 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -61,6 +61,9 @@ static void dwc2_set_param_phy_type(struct dwc2 *dwc2)
 	case GHWCFG2_HS_PHY_TYPE_ULPI:
 		val = DWC2_PHY_TYPE_PARAM_ULPI;
 		break;
+	default:
+		dwc2_warn(dwc2, "Unhandled HS PHY type\n");
+		fallthrough;
 	case GHWCFG2_HS_PHY_TYPE_NOT_SUPPORTED:
 		val = DWC2_PHY_TYPE_PARAM_FS;
 		break;
-- 
2.30.2




More information about the barebox mailing list