All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/PM] arm: omap: musb: proper error checking
@ 2010-05-19  6:42 felipe.balbi
  2010-05-19  9:09 ` Felipe Balbi
  0 siblings, 1 reply; 2+ messages in thread
From: felipe.balbi @ 2010-05-19  6:42 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: Linux OMAP Mailing List, Felipe Balbi

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

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

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---

applies on top of the linux-omap/pm

 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH/PM] arm: omap: musb: proper error checking
  2010-05-19  6:42 [PATCH/PM] arm: omap: musb: proper error checking felipe.balbi
@ 2010-05-19  9:09 ` Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2010-05-19  9:09 UTC (permalink / raw)
  To: Balbi Felipe (Nokia-D/Helsinki); +Cc: Kevin Hilman, Linux OMAP Mailing List

On Wed, May 19, 2010 at 08:42:56AM +0200, Balbi Felipe (Nokia-D/Helsinki) wrote:
>From: Felipe Balbi <felipe.balbi@nokia.com>
>
>We need to clk_put() and iounmap() to fully release
>the resources.
>
>Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
>---
>
>applies on top of the linux-omap/pm

I'll add more patches, Kevin don't take this yet.

-- 
balbi

DefectiveByDesign.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-19  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-19  6:42 [PATCH/PM] arm: omap: musb: proper error checking felipe.balbi
2010-05-19  9:09 ` Felipe Balbi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.