usb: host: xhci: move HC_STATE_SUSPENDED check to xhci_suspend()
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / usb / host / xhci.c
index 09987d57934c993d3bc1c45335bfff776af4a55d..5c72c431bab18da941ec9a1a235c134086065482 100644 (file)
@@ -880,6 +880,10 @@ int xhci_suspend(struct xhci_hcd *xhci)
        struct usb_hcd          *hcd = xhci_to_hcd(xhci);
        u32                     command;
 
+       if (hcd->state != HC_STATE_SUSPENDED ||
+                       xhci->shared_hcd->state != HC_STATE_SUSPENDED)
+               return -EINVAL;
+
        spin_lock_irq(&xhci->lock);
        clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
        clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);