xhci: fix oops when xhci resumes from hibernate with hw lpm capable devices
authorMathias Nyman <mathias.nyman@linux.intel.com>
Thu, 11 Sep 2014 10:55:50 +0000 (13:55 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 21:52:15 +0000 (14:52 -0700)
commitfe4b28ee560fc60ccd1f66ec218ee2aa80ba4612
tree953978e9ad0f8e80b60487f30c0db512e36dc308
parentf9fa62e52f2b895b326474e5d85c20bd8ddc41ab
xhci: fix oops when xhci resumes from hibernate with hw lpm capable devices

commit 96044694b8511bc2b04df0776b4ba295cfe005c0 upstream.

Resuming from hibernate (S4) will restart and re-initialize xHC.
The device contexts are freed and will be re-allocated later during device reset.

Usb core will disable link pm in device resume before device reset, which will
try to change the max exit latency, accessing the device contexts before they are re-allocated.

There is no need to zero (disable) the max exit latency when disabling hw lpm
for a freshly re-initialized xHC. So check that device context exists before
doing anything. The max exit latency will be set again after device reset when usb core
enables the link pm.

Reported-by: Imre Deak <imre.deak@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci.c