Skip to contentSkip to conversation

usb: dwc3: prevent setting PRTCAP to OTG from debugfs

PATCH New Roger Quadros 1 participant 1 message Feb 27, 2018

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

PATCH 1/1 usb: dwc3: prevent setting PRTCAP to OTG from debugfs

We don't support PRTCAP == OTG yet, so prevent user from setting it via debugfs.

Fixes 41ce1456e1db ("usb: dwc3: core: make dwc3_set_mode() work properly")
Cc <[email protected]> # v4.12+
---
 drivers/usb/dwc3/core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/dwc3/core.c +3 -0
index e94bf91..df4569d 100644
@@ -119,6 +119,9 @@ static void __dwc3_set_mode(struct work_struct *work)
 	if (dwc->dr_mode != USB_DR_MODE_OTG)
 		return;
 
+	if (dwc->desired_dr_role == DWC3_GCTL_PRTCAP_OTG)
+		return;
+
 	switch (dwc->current_dr_role) {
 	case DWC3_GCTL_PRTCAP_HOST:
 		dwc3_host_exit(dwc);