aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-12-25 20:44:30 -0500
committerBrian Norris <computersforpeace@gmail.com>2014-01-03 14:22:28 -0500
commit133432a7e2b848ada53910df16c420d297e5c65a (patch)
tree9ca7ac0a0e1af6c6c1c131aca9384332b1d8cad5
parent2281f7b63ed0a7e230a34303c0e9e8f0264fda6c (diff)
mtd: lpc32xx_slc: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Roland Stigge <stigge@antcom.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r--drivers/mtd/nand/lpc32xx_slc.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index 23e6974ccd20..5f2039446bf0 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -791,8 +791,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
791 } 791 }
792 if (host->ncfg->wp_gpio == -EPROBE_DEFER) 792 if (host->ncfg->wp_gpio == -EPROBE_DEFER)
793 return -EPROBE_DEFER; 793 return -EPROBE_DEFER;
794 if (gpio_is_valid(host->ncfg->wp_gpio) && 794 if (gpio_is_valid(host->ncfg->wp_gpio) && devm_gpio_request(&pdev->dev,
795 gpio_request(host->ncfg->wp_gpio, "NAND WP")) { 795 host->ncfg->wp_gpio, "NAND WP")) {
796 dev_err(&pdev->dev, "GPIO not available\n"); 796 dev_err(&pdev->dev, "GPIO not available\n");
797 return -EBUSY; 797 return -EBUSY;
798 } 798 }
@@ -808,7 +808,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
808 mtd->dev.parent = &pdev->dev; 808 mtd->dev.parent = &pdev->dev;
809 809
810 /* Get NAND clock */ 810 /* Get NAND clock */
811 host->clk = clk_get(&pdev->dev, NULL); 811 host->clk = devm_clk_get(&pdev->dev, NULL);
812 if (IS_ERR(host->clk)) { 812 if (IS_ERR(host->clk)) {
813 dev_err(&pdev->dev, "Clock failure\n"); 813 dev_err(&pdev->dev, "Clock failure\n");
814 res = -ENOENT; 814 res = -ENOENT;
@@ -927,10 +927,8 @@ err_exit3:
927 dma_release_channel(host->dma_chan); 927 dma_release_channel(host->dma_chan);
928err_exit2: 928err_exit2:
929 clk_disable(host->clk); 929 clk_disable(host->clk);
930 clk_put(host->clk);
931err_exit1: 930err_exit1:
932 lpc32xx_wp_enable(host); 931 lpc32xx_wp_enable(host);
933 gpio_free(host->ncfg->wp_gpio);
934 932
935 return res; 933 return res;
936} 934}
@@ -953,9 +951,7 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)
953 writel(tmp, SLC_CTRL(host->io_base)); 951 writel(tmp, SLC_CTRL(host->io_base));
954 952
955 clk_disable(host->clk); 953 clk_disable(host->clk);
956 clk_put(host->clk);
957 lpc32xx_wp_enable(host); 954 lpc32xx_wp_enable(host);
958 gpio_free(host->ncfg->wp_gpio);
959 955
960 return 0; 956 return 0;
961} 957}