From patchwork Thu Aug 23 11:41:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10903 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5F79023E00 for ; Thu, 23 Aug 2012 11:42:31 +0000 (UTC) Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) by fiordland.canonical.com (Postfix) with ESMTP id 77625A18FC8 for ; Thu, 23 Aug 2012 11:42:16 +0000 (UTC) Received: by obceq6 with SMTP id eq6so1230642obc.11 for ; Thu, 23 Aug 2012 04:42:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=h+/XXJ1FHMv0XjdKUU2KncDr65XIK4USoxDaRrDNKzI=; b=C8t6gPBOqsZlrzyaDJvMN6SDUZtjqasa/hIb3p+ZQAsox+9/59Jv2DU3DJMoox6H0K P/8YMrRBQZX4BCcQcOn1s33xYpnBUWx/DhGV+Mgs2a8nxKLjWK/vkwosjes75eLCCb4H giVQop1OayVndxwY/xXoPkFiB6knx/DQbAkkdbq9gO6m1BWpqdJxgUVR2iDVIAb2hRce ySauK+hOPp+eW/uWB+lKHtetI/xrzknRGASzNljJQ8MTf220J7HgYxxusW0J4eihr0X4 prtgjJCqVWXMhkrGauvLcHeZzYh2j6lgGHj1xvz5Spttqe5VnLF76cK0X/vW/T6yZp+6 gsog== Received: by 10.50.87.164 with SMTP id az4mr1143906igb.43.1345722149369; Thu, 23 Aug 2012 04:42:29 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp254474igc; Thu, 23 Aug 2012 04:42:28 -0700 (PDT) Received: by 10.14.0.198 with SMTP id 46mr1537271eeb.30.1345722147803; Thu, 23 Aug 2012 04:42:27 -0700 (PDT) Received: from eu1sys200aog106.obsmtp.com (eu1sys200aog106.obsmtp.com. [207.126.144.121]) by mx.google.com with SMTP id e9si4599871eep.46.2012.08.23.04.42.24 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 23 Aug 2012 04:42:27 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.121 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.121; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.121 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) smtp.mail=ulf.hansson@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob106.postini.com ([207.126.147.11]) with SMTP ID DSNKUDYXHo+hO+HXd9zCrXrUh1e1w3F3DTu4@postini.com; Thu, 23 Aug 2012 11:42:27 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 30DD910E; Thu, 23 Aug 2012 11:42:21 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B91502546; Thu, 23 Aug 2012 11:42:20 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 0A11524C07C; Thu, 23 Aug 2012 13:42:14 +0200 (CEST) Received: from steludxu1397.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 23 Aug 2012 13:42:20 +0200 From: Ulf Hansson To: Vinod Koul Cc: , Dan Williams , Lee Jones , Srinidhi Kasagar , Ulf Hansson Subject: [PATCH] dma/ste_dma40: Fixup clock usage during probe Date: Thu, 23 Aug 2012 13:41:58 +0200 Message-ID: <1345722118-5783-1-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlcwVyzELLKbwWWBUyhpatCB6ldj7xAxMBUM8ve91fuyaB2wFwnYCp7JeNPrihVO392wL4L From: Ulf Hansson Fixup some errorhandling for clocks during probe and make sure to use clk_prepare as well as clk_enable. Signed-off-by: Ulf Hansson Acked-by: Linus Walleij --- drivers/dma/ste_dma40.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 000d309..826d0d5 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -2920,19 +2920,23 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) struct d40_base *base = NULL; int num_log_chans = 0; int num_phy_chans; + int clk_ret = -EINVAL; int i; u32 pid; u32 cid; u8 rev; clk = clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { d40_err(&pdev->dev, "No matching clock found\n"); goto failure; } - clk_enable(clk); + clk_ret = clk_prepare_enable(clk); + if (clk_ret) { + d40_err(&pdev->dev, "Failed to prepare/enable clock\n"); + goto failure; + } /* Get IO for DMAC base address */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "base"); @@ -3062,10 +3066,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) return base; failure: - if (!IS_ERR(clk)) { - clk_disable(clk); + if (!clk_ret) + clk_disable_unprepare(clk); + if (!IS_ERR(clk)) clk_put(clk); - } if (virtbase) iounmap(virtbase); if (res)