pwm: Convert pwm-tegra to use devm_clk_get()
authorAxel Lin <axel.lin@gmail.com>
Sun, 1 Jul 2012 05:00:51 +0000 (13:00 +0800)
committerThierry Reding <thierry.reding@avionic-design.de>
Mon, 23 Jul 2012 11:24:02 +0000 (13:24 +0200)
Also return proper error in tegra_pwm_remove() if pwmchip_remove()
fails.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
drivers/pwm/pwm-tegra.c

index 472b74e8221a7f8685fd24fe333ea2bc749422f1..02ce18d5e49a7800e396d2e519692bc1937701bf 100644 (file)
@@ -194,7 +194,7 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, pwm);
 
-       pwm->clk = clk_get(&pdev->dev, NULL);
+       pwm->clk = devm_clk_get(&pdev->dev, NULL);
        if (IS_ERR(pwm->clk))
                return PTR_ERR(pwm->clk);
 
@@ -206,7 +206,6 @@ static int tegra_pwm_probe(struct platform_device *pdev)
        ret = pwmchip_add(&pwm->chip);
        if (ret < 0) {
                dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
-               clk_put(pwm->clk);
                return ret;
        }
 
@@ -233,10 +232,7 @@ static int __devexit tegra_pwm_remove(struct platform_device *pdev)
                clk_disable_unprepare(pc->clk);
        }
 
-       pwmchip_remove(&pc->chip);
-       clk_put(pc->clk);
-
-       return 0;
+       return pwmchip_remove(&pc->chip);
 }
 
 #ifdef CONFIG_OF