From patchwork Wed May 19 06:42:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 100784 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4J6jPAI023502 for ; Wed, 19 May 2010 06:45:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753077Ab0ESGpY (ORCPT ); Wed, 19 May 2010 02:45:24 -0400 Received: from smtp.nokia.com ([192.100.122.230]:46173 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752468Ab0ESGpX (ORCPT ); Wed, 19 May 2010 02:45:23 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o4J6jJU2000902; Wed, 19 May 2010 09:45:20 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 19 May 2010 09:45:00 +0300 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 19 May 2010 09:44:59 +0300 Received: from scadufax.research.nokia.com (esdhcp041223.research.nokia.com [172.21.41.223]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o4J6iwwo008299; Wed, 19 May 2010 09:44:58 +0300 From: felipe.balbi@nokia.com To: Kevin Hilman Cc: Linux OMAP Mailing List , Felipe Balbi Subject: [PATCH/PM] arm: omap: musb: proper error checking Date: Wed, 19 May 2010 09:42:56 +0300 Message-Id: <1274251376-6111-1-git-send-email-felipe.balbi@nokia.com> X-Mailer: git-send-email 1.7.1 X-OriginalArrivalTime: 19 May 2010 06:44:59.0620 (UTC) FILETIME=[CD234240:01CAF71E] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 19 May 2010 06:45:25 +0000 (UTC) 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)