Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: host: ehci-msm: Conditionally call ehci suspend/resume

This patch fixes a suspend/resume issue where the driver is blindly
calling ehci_suspend/resume functions when the ehci hasn't been setup.
This results in a crash during suspend/resume operations.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
Tested-by: Pramod Gurav <pramod.gurav@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Gross and committed by
Greg Kroah-Hartman
815c9d6a 1700bd98

+12 -2
+12 -2
drivers/usb/host/ehci-msm.c
··· 179 179 static int ehci_msm_pm_suspend(struct device *dev) 180 180 { 181 181 struct usb_hcd *hcd = dev_get_drvdata(dev); 182 + struct ehci_hcd *ehci = hcd_to_ehci(hcd); 182 183 bool do_wakeup = device_may_wakeup(dev); 183 184 184 185 dev_dbg(dev, "ehci-msm PM suspend\n"); 185 186 186 - return ehci_suspend(hcd, do_wakeup); 187 + /* Only call ehci_suspend if ehci_setup has been done */ 188 + if (ehci->sbrn) 189 + return ehci_suspend(hcd, do_wakeup); 190 + 191 + return 0; 187 192 } 188 193 189 194 static int ehci_msm_pm_resume(struct device *dev) 190 195 { 191 196 struct usb_hcd *hcd = dev_get_drvdata(dev); 197 + struct ehci_hcd *ehci = hcd_to_ehci(hcd); 192 198 193 199 dev_dbg(dev, "ehci-msm PM resume\n"); 194 - ehci_resume(hcd, false); 200 + 201 + /* Only call ehci_resume if ehci_setup has been done */ 202 + if (ehci->sbrn) 203 + ehci_resume(hcd, false); 195 204 196 205 return 0; 197 206 } 207 + 198 208 #else 199 209 #define ehci_msm_pm_suspend NULL 200 210 #define ehci_msm_pm_resume NULL