From 8c54875c34512e82a601d07d7061829850c5c5e6 Mon Sep 17 00:00:00 2001 From: Rohith Kollalsi Date: Thu, 11 Nov 2021 10:47:41 +0530 Subject: [PATCH] usb: host: Fix unclocked access in xhci_suspend in case of pm suspend When runtime suspend occurs xhci_suspend is called and now all the clocks are turned off. Now if pm_suspend happens xhci_suspend is again called which leads to unclocked access of registers in function xhci_disable_hub_port_wake. Fix this by considering second call of xhci_suspend due to pm_suspend as no-op. Change-Id: Ic053636ac1d6c54150b40e5477b5eb373fcdbeb3 Signed-off-by: Rohith Kollalsi --- drivers/usb/host/xhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 272802738e13..aaf212d5751f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1013,13 +1013,13 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) xhci->shared_hcd->state != HC_STATE_SUSPENDED) return -EINVAL; + if (!HCD_HW_ACCESSIBLE(hcd)) + return 0; + /* Clear root port wake on bits if wakeup not allowed. */ xhci_disable_hub_port_wake(xhci, &xhci->usb3_rhub, do_wakeup); xhci_disable_hub_port_wake(xhci, &xhci->usb2_rhub, do_wakeup); - if (!HCD_HW_ACCESSIBLE(hcd)) - return 0; - xhci_dbc_suspend(xhci); /* Don't poll the roothubs on bus suspend. */