From: Felipe Balbi <felipe.ba...@nokia.com>

We need to clk_put() and iounmap() to fully release
the resources.

Signed-off-by: Felipe Balbi <felipe.ba...@nokia.com>
---
 arch/arm/mach-omap2/usb-musb.c |   33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 116548d..085e22e 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -60,23 +60,34 @@ static void __init usb_musb_pm_init(void)
 
        dev_set_name(dev, "musb_hdrc");
        otg_clk = clk_get(dev, "ick");
+       if (IS_ERR(otg_clk)) {
+               printk(KERN_WARNING "%s: Unable to get clock for MUSB.\n",
+                               __func__);
+               goto out0;
+       }
 
-       if (otg_clk && clk_enable(otg_clk)) {
+       if (clk_enable(otg_clk)) {
                printk(KERN_WARNING
                        "%s: Unable to enable clocks for MUSB, "
                        "cannot reset.\n",  __func__);
-       } else {
-               /* Reset OTG controller. After reset, it will be in
-                * force-idle, force-standby mode. */
-               __raw_writel(OTG_SYSC_SOFTRESET, otg_base + OTG_SYSCONFIG);
-
-               while (!(OTG_SYSS_RESETDONE &
-                                       __raw_readl(otg_base + OTG_SYSSTATUS)))
-                       cpu_relax();
+               goto out1;
        }
 
-       if (otg_clk)
-               clk_disable(otg_clk);
+       /* Reset OTG controller. After reset, it will be in
+        * force-idle, force-standby mode. */
+       __raw_writel(OTG_SYSC_SOFTRESET, otg_base + OTG_SYSCONFIG);
+
+       while (!(OTG_SYSS_RESETDONE &
+                               __raw_readl(otg_base + OTG_SYSSTATUS)))
+               cpu_relax();
+
+       clk_disable(otg_clk);
+
+out1:
+       clk_put(otg_clk);
+
+out0:
+       iounmap(otg_base);
 }
 
 void usb_musb_disable_autoidle(void)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to