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:54:10 +0000 (14:54 -0700)
commit1fdbb939b8b3fb23fd03ba617baca64458449966
tree2f7fe02dc7220ba12bfa7654a6d1343a7badbc50
parent7aeede98bdbcbca2956822ce7a871e875663c6b6
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