]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
ARM: Orion: fix driver probe error handling with respect to clk
authorSimon Baatz <gmbnomis@gmail.com>
Wed, 18 Jul 2012 22:04:09 +0000 (00:04 +0200)
committerAndrew Lunn <andrew@lunn.ch>
Wed, 25 Jul 2012 15:06:21 +0000 (17:06 +0200)
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 <gmbnomis@gmail.com>
Signed-off-by: Andrew Lumm <andrew@lunn.ch>
drivers/crypto/mv_cesa.c
drivers/mmc/host/mvsdio.c
drivers/mtd/nand/orion_nand.c
drivers/net/ethernet/marvell/mv643xx_eth.c
drivers/usb/host/ehci-orion.c
sound/soc/kirkwood/kirkwood-i2s.c

index 1cc6b3f3e262ac72ad958ea8e34a59c00663ed71..a4faa893199c822dc4d69bc5001b5432314b4509 100644 (file)
@@ -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:
index 3b9136c1a475428b8e95732de6425215dc2d337c..a61cb5fca22d360e600974fb754470666d7f612d 100644 (file)
@@ -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;
index 513dc88a05ca422ac23525dac7db3f20ef9b0bfc..9b8fd3d771681e6c7f261e67681beea7ca854e9a 100644 (file)
@@ -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:
index f0f06b2bc28b3f951933c19bde6e788adcc7c5bf..4fbba57b8ff46b90a58ccb6ca9aba24572539d1c 100644 (file)
@@ -2983,6 +2983,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
        return 0;
 
 out:
+#if defined(CONFIG_HAVE_CLK)
+       if (!IS_ERR(mp->clk)) {
+               clk_disable_unprepare(mp->clk);
+               clk_put(mp->clk);
+       }
+#endif
        free_netdev(dev);
 
        return err;
index 82de1073aa529ae105da5ac374face13e6b35bd2..c6903e3af29c5f43ca06d3bd8f89662d454e1f54 100644 (file)
@@ -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));
index fa4556750451ce29f7236174356573b65e52e56c..7646dd7f30cb084fc83c58b8b802085e45770ef4 100644 (file)
@@ -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);