mtd: nand: fsmc: use devm_clk_get()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed May 10 19:59:08 PDT 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=fb8ed2ca432443ef1898aad7501c6e63c5c94f8e
Commit:     fb8ed2ca432443ef1898aad7501c6e63c5c94f8e
Parent:     a1b1e1d5bdfe79e3d3b28387dd43bb16531be5a4
Author:     Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
AuthorDate: Tue Mar 21 11:04:03 2017 +0100
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Thu Mar 23 11:11:31 2017 +0100

    mtd: nand: fsmc: use devm_clk_get()
    
    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 at free-electrons.com>
    Reviewed-by: Linus Walleij <linus.walleij at linaro.org>
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 drivers/mtd/nand/fsmc_nand.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 4c6e239..f611eb0 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -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;



More information about the linux-mtd-cvs mailing list