]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: dwc3: core: fix order of PM runtime calls
authorFelipe Balbi <balbi@ti.com>
Tue, 2 Sep 2014 19:57:20 +0000 (14:57 -0500)
committerFelipe Balbi <balbi@ti.com>
Wed, 3 Sep 2014 21:50:44 +0000 (16:50 -0500)
Currently, we disable pm_runtime before all register
accesses are done, this is dangerous and might lead
to abort exceptions due to the driver trying to access
a register which is clocked by a clock which was long
gated.

Fix that by moving pm_runtime_put_sync() and pm_runtime_disable()
as the last thing we do before returning from our ->remove()
method.

Fixes: 72246da (usb: Introduce DesignWare USB3 DRD Driver)
Cc: <stable@vger.kernel.org> # v3.2+
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/core.c

index b769c1faaf0385dff2543592e2fe68745d1fc7c5..a664d5b5bdfd8e48c941bafebe742fa1e8bcd12f 100644 (file)
@@ -804,15 +804,15 @@ static int dwc3_remove(struct platform_device *pdev)
        phy_power_off(dwc->usb2_generic_phy);
        phy_power_off(dwc->usb3_generic_phy);
 
-       pm_runtime_put_sync(&pdev->dev);
-       pm_runtime_disable(&pdev->dev);
-
        dwc3_debugfs_exit(dwc);
        dwc3_core_exit_mode(dwc);
        dwc3_event_buffers_cleanup(dwc);
        dwc3_free_event_buffers(dwc);
        dwc3_core_exit(dwc);
 
+       pm_runtime_put_sync(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
+
        return 0;
 }