summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jun <B47624@freescale.com>2014-07-31 14:01:40 +0800
committerLi Jun <B47624@freescale.com>2014-08-01 16:13:30 +0800
commit24f2a0187a52bfad75212a7b6a2cd107bde0d183 (patch)
tree1e2cd8f0483b461983eb6660bf5fc792241ffaaf
parent5762c7ac48745d41c64aac483ce3070e10a4306c (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.c7
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)
void ci_hdrc_host_save_for_power_lost(struct ci_hdrc *ci)
{
- struct ehci_hcd *ehci = hcd_to_ehci(ci->hcd);
+ struct ehci_hcd *ehci;
+
+ if (!ci->hcd)
+ return;
+
+ ehci = hcd_to_ehci(ci->hcd);
/* save EHCI registers */
ci->pm_command = ehci_readl(ehci, &ehci->regs->command);