usb: dwc3: rockchip: fix otg plug out error before resume

ID dig disconnect interrupt will happen and notify dwc3 controller
to remove hcd as soon as resume, and release root hub, but the hcd
has not resume, so there is a logic error and it may result in NULL
pointer, this patch forbid remove hcd when the state of hcd is suspend.

Change-Id: Ia5673848a23528cd053d75910c0fdbddf0927a40
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
This commit is contained in:
Meng Dongyang
2016-10-07 13:50:59 +08:00
committed by Huang, Tao
parent 22e5631e63
commit ccc954ee9f

View File

@@ -210,6 +210,11 @@ static void dwc3_rockchip_otg_extcon_evt_work(struct work_struct *work)
DWC3_GCTL_PRTCAP(reg) == DWC3_GCTL_PRTCAP_OTG) {
hcd = dev_get_drvdata(&dwc->xhci->dev);
if (hcd->state == HC_STATE_SUSPENDED) {
dev_dbg(rockchip->dev, "USB suspended\n");
goto out;
}
if (hcd->state != HC_STATE_HALT) {
usb_remove_hcd(hcd->shared_hcd);
usb_remove_hcd(hcd);