usb: ehci-msm2: Fix unbalanced clock warning
The EHCI controller may be in suspend state in which its clocks
are already disabled. Fix warning given by clock subsystem when
disabling the clocks a second time when the controller's platform
device is removed by first checking if the device is suspended.
Change-Id: I3c491d0db11cc172d0e6779042c04fc726936b36
Signed-off-by: Jack Pham <jackp@codeaurora.org>
diff --git a/drivers/usb/host/ehci-msm2.c b/drivers/usb/host/ehci-msm2.c
index 03554fc..6eb083e 100644
--- a/drivers/usb/host/ehci-msm2.c
+++ b/drivers/usb/host/ehci-msm2.c
@@ -877,8 +877,10 @@
return 0;
put_clocks:
- clk_disable_unprepare(mhcd->iface_clk);
- clk_disable_unprepare(mhcd->core_clk);
+ if (!atomic_read(&mhcd->in_lpm)) {
+ clk_disable_unprepare(mhcd->iface_clk);
+ clk_disable_unprepare(mhcd->core_clk);
+ }
clk_put(mhcd->core_clk);
put_iface_clk:
clk_put(mhcd->iface_clk);