diff options
author | Li Jun <B47624@freescale.com> | 2014-07-31 02:01:40 -0400 |
---|---|---|
committer | Li Jun <B47624@freescale.com> | 2014-08-01 04:13:30 -0400 |
commit | 24f2a0187a52bfad75212a7b6a2cd107bde0d183 (patch) | |
tree | 1e2cd8f0483b461983eb6660bf5fc792241ffaaf | |
parent | 5762c7ac48745d41c64aac483ce3070e10a4306c (diff) |
ENGR00325203 usb: chipidea: host: check if ci->hcd initialized before access it
When ci core driver enable runtime pm in probe, it's possible runtime suspend
will be started before otg fsm queue work get to run, in this case, host has not
been started yet so ci->hcd is NULL, but suspend routine will access it for save
ehci registers, which result in kernle panic, this patch adds pointer valid check.
Signed-off-by: Li Jun <b47624@freescale.com>
-rw-r--r-- | drivers/usb/chipidea/host.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index b14810a940f2..9f2b015ef876 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c | |||
@@ -341,7 +341,12 @@ bool ci_hdrc_host_has_device(struct ci_hdrc *ci) | |||
341 | 341 | ||
342 | void ci_hdrc_host_save_for_power_lost(struct ci_hdrc *ci) | 342 | void ci_hdrc_host_save_for_power_lost(struct ci_hdrc *ci) |
343 | { | 343 | { |
344 | struct ehci_hcd *ehci = hcd_to_ehci(ci->hcd); | 344 | struct ehci_hcd *ehci; |
345 | |||
346 | if (!ci->hcd) | ||
347 | return; | ||
348 | |||
349 | ehci = hcd_to_ehci(ci->hcd); | ||
345 | 350 | ||
346 | /* save EHCI registers */ | 351 | /* save EHCI registers */ |
347 | ci->pm_command = ehci_readl(ehci, &ehci->regs->command); | 352 | ci->pm_command = ehci_readl(ehci, &ehci->regs->command); |