]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
spi: ath79: Use devm_*() functions
authorJingoo Han <jg1.han@samsung.com>
Mon, 9 Dec 2013 10:14:58 +0000 (19:14 +0900)
committerMark Brown <broonie@linaro.org>
Tue, 17 Dec 2013 22:53:36 +0000 (22:53 +0000)
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-ath79.c

index 821bf7ac218d965411027e3ce7efe16ed8e3e567..31534b51715aa95e29664cc80d44d71b5131d0ab 100644 (file)
@@ -243,21 +243,21 @@ static int ath79_spi_probe(struct platform_device *pdev)
                goto err_put_master;
        }
 
-       sp->base = ioremap(r->start, resource_size(r));
+       sp->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));
        if (!sp->base) {
                ret = -ENXIO;
                goto err_put_master;
        }
 
-       sp->clk = clk_get(&pdev->dev, "ahb");
+       sp->clk = devm_clk_get(&pdev->dev, "ahb");
        if (IS_ERR(sp->clk)) {
                ret = PTR_ERR(sp->clk);
-               goto err_unmap;
+               goto err_put_master;
        }
 
        ret = clk_enable(sp->clk);
        if (ret)
-               goto err_clk_put;
+               goto err_put_master;
 
        rate = DIV_ROUND_UP(clk_get_rate(sp->clk), MHZ);
        if (!rate) {
@@ -280,10 +280,6 @@ err_disable:
        ath79_spi_disable(sp);
 err_clk_disable:
        clk_disable(sp->clk);
-err_clk_put:
-       clk_put(sp->clk);
-err_unmap:
-       iounmap(sp->base);
 err_put_master:
        spi_master_put(sp->bitbang.master);
 
@@ -297,8 +293,6 @@ static int ath79_spi_remove(struct platform_device *pdev)
        spi_bitbang_stop(&sp->bitbang);
        ath79_spi_disable(sp);
        clk_disable(sp->clk);
-       clk_put(sp->clk);
-       iounmap(sp->base);
        spi_master_put(sp->bitbang.master);
 
        return 0;