usb: dwc3: prevent setting PRTCAP to OTG from debugfs
authorRoger Quadros <rogerq@ti.com>
Tue, 27 Feb 2018 10:54:37 +0000 (12:54 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 13 Mar 2018 08:47:51 +0000 (10:47 +0200)
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: <stable@vger.kernel.org> # v4.12+
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/core.c

index f1d838a..b014c87 100644 (file)
@@ -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);