From patchwork Wed Jul 18 22:04:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Baatz X-Patchwork-Id: 1213261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 247EBDFFFD for ; Wed, 18 Jul 2012 22:08:23 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SrcMP-0003F3-MS; Wed, 18 Jul 2012 22:04:45 +0000 Received: from mail-wg0-f49.google.com ([74.125.82.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SrcMD-0003El-O0 for linux-arm-kernel@lists.infradead.org; Wed, 18 Jul 2012 22:04:36 +0000 Received: by wgbez12 with SMTP id ez12so1296060wgb.18 for ; Wed, 18 Jul 2012 15:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=U5E8+jOgwRw4r/mJZIMI5KIU+CZQxRI6+kP53sEcNiE=; b=Bf1ykLib1jxAZSo0TOSYJCHmqCXJp7TpHaUUHF7YewbVXGJpkAC+fvE2XExDqOl2dN FgRMcExTFZVkMpYySzvZLRdZnHLyZu75isUlmwkmI4rqANJvRGLQ3vp3N9kbyIp4fFAX UWSvYwAhvEJBdQq+r6Cg3BJT9L1nmeLBe11p8YlzoTAU/q5EUJMSxL9Qg52k/r/y+a8n N7edFI16Z7OrgUNy5RcwLkGodJFT7kG3N8TMGlFyOBFeC3e96NN1Kg6SC1Jo1d5H5qBe diCl8Uxwjur9Eb4Z2CIqVf5uUb5WUYoKP3WgaSI+13w4pPCF+NICIrkVlG8MQZFfmKO/ x+Rg== Received: by 10.216.139.145 with SMTP id c17mr1381360wej.175.1342649069175; Wed, 18 Jul 2012 15:04:29 -0700 (PDT) Received: from gandalf.schnuecks.de (p5DE8D460.dip.t-dialin.net. [93.232.212.96]) by mx.google.com with ESMTPS id w7sm34834943wiz.0.2012.07.18.15.04.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jul 2012 15:04:28 -0700 (PDT) Received: by gandalf.schnuecks.de (Postfix, from userid 500) id 0931640FB2; Thu, 19 Jul 2012 00:04:26 +0200 (CEST) From: Simon Baatz To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: Orion: fix driver probe error handling with respect to clk Date: Thu, 19 Jul 2012 00:04:09 +0200 Message-Id: <1342649049-3956-1-git-send-email-gmbnomis@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (gmbnomis[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: andrew@lunn.ch, jason@lakedaemon.net, gmbnomis@gmail.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The clk patches added code to get and enable clocks in the respective driver probe functions. If the probe function failed for some reason after enabling the clock, the clock was not disabled again in many cases. Signed-off-by: Simon Baatz --- Hi, some hopefully obvious fixes to driver probe cleanup code. Patch is based on v3.5-rc7. Let me know if you prefer a series of per driver patches instead. - Simon drivers/crypto/mv_cesa.c | 4 ++++ drivers/mmc/host/mvsdio.c | 4 ++++ drivers/mtd/nand/orion_nand.c | 4 ++++ drivers/net/ethernet/marvell/mv643xx_eth.c | 4 ++++ drivers/usb/host/ehci-orion.c | 4 ++++ sound/soc/kirkwood/kirkwood-i2s.c | 8 +++++++- 6 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index 1cc6b3f..a4faa893 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c @@ -1098,6 +1098,10 @@ err_unreg_ecb: crypto_unregister_alg(&mv_aes_alg_ecb); err_irq: free_irq(irq, cp); + if (!IS_ERR(cp->clk)) { + clk_disable_unprepare(cp->clk); + clk_put(cp->clk); + } err_thread: kthread_stop(cp->queue_th); err_unmap_sram: diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index 3b9136c..a61cb5f 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c @@ -839,6 +839,10 @@ out: if (r) release_resource(r); if (mmc) + if (!IS_ERR_OR_NULL(host->clk)) { + clk_disable_unprepare(host->clk); + clk_put(host->clk); + } mmc_free_host(mmc); return ret; diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index 513dc88..9b8fd3d 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c @@ -183,6 +183,10 @@ static int __init orion_nand_probe(struct platform_device *pdev) return 0; no_dev: + if (!IS_ERR(clk)) { + clk_disable_unprepare(clk); + clk_put(clk); + } platform_set_drvdata(pdev, NULL); iounmap(io_base); no_res: diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index f0f06b2..c496720 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2983,6 +2983,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev) return 0; out: + if (!IS_ERR(mp->clk)) { + clk_disable_unprepare(mp->clk); + clk_put(mp->clk); + } free_netdev(dev); return err; diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 82de107..c6903e3 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c @@ -298,6 +298,10 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev) err4: usb_put_hcd(hcd); err3: + if (!IS_ERR(clk)) { + clk_disable_unprepare(clk); + clk_put(clk); + } iounmap(regs); err2: release_mem_region(res->start, resource_size(res)); diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index fa45567..7646dd7 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c @@ -458,7 +458,13 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) } clk_prepare_enable(priv->clk); - return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); + err = snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); + if (!err) + return 0; + dev_err(&pdev->dev, "snd_soc_register_dai failed\n"); + + clk_disable_unprepare(priv->clk); + clk_put(priv->clk); err_ioremap: iounmap(priv->io);