]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mtd: nand: fsmc: use devm_clk_get()
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 21 Mar 2017 10:04:03 +0000 (11:04 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 23 Mar 2017 10:11:31 +0000 (11:11 +0100)
This commit switches the fsmc_nand driver from clk_get() to
devm_clk_get(), which saves a few clk_put().

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/fsmc_nand.c

index 4c6e239dcee8c226b826c44524d9def9947e7031..f611eb04184c5b274f300c751724900178bd8c89 100644 (file)
@@ -870,7 +870,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
        if (IS_ERR(host->regs_va))
                return PTR_ERR(host->regs_va);
 
-       host->clk = clk_get(&pdev->dev, NULL);
+       host->clk = devm_clk_get(&pdev->dev, NULL);
        if (IS_ERR(host->clk)) {
                dev_err(&pdev->dev, "failed to fetch block clock\n");
                return PTR_ERR(host->clk);
@@ -878,7 +878,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 
        ret = clk_prepare_enable(host->clk);
        if (ret)
-               goto err_clk_prepare_enable;
+               return ret;
 
        /*
         * This device ID is actually a common AMBA ID as used on the
@@ -1045,8 +1045,6 @@ err_req_write_chnl:
                dma_release_channel(host->read_dma_chan);
 err_req_read_chnl:
        clk_disable_unprepare(host->clk);
-err_clk_prepare_enable:
-       clk_put(host->clk);
        return ret;
 }
 
@@ -1065,7 +1063,6 @@ static int fsmc_nand_remove(struct platform_device *pdev)
                        dma_release_channel(host->read_dma_chan);
                }
                clk_disable_unprepare(host->clk);
-               clk_put(host->clk);
        }
 
        return 0;