]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pwm: spear: Fix checking return value of clk_enable() and clk_prepare()
authorAxel Lin <axel.lin@ingics.com>
Sat, 30 Mar 2013 12:43:22 +0000 (20:43 +0800)
committerThierry Reding <thierry.reding@avionic-design.de>
Tue, 2 Apr 2013 09:28:36 +0000 (11:28 +0200)
The logic to check return value of clk_enable() and clk_prepare() is reversed,
fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Cc: stable@vger.kernel.org
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
drivers/pwm/pwm-spear.c

index 69a2d9eb34db01d7efdb468ef061ee70727c0f6b..3223b57e8f9c6af874ab9ec473f7c73a5d9b3bfc 100644 (file)
@@ -143,7 +143,7 @@ static int spear_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
        u32 val;
 
        rc = clk_enable(pc->clk);
-       if (!rc)
+       if (rc)
                return rc;
 
        val = spear_pwm_readl(pc, pwm->hwpwm, PWMCR);
@@ -209,12 +209,12 @@ static int spear_pwm_probe(struct platform_device *pdev)
        pc->chip.npwm = NUM_PWM;
 
        ret = clk_prepare(pc->clk);
-       if (!ret)
+       if (ret)
                return ret;
 
        if (of_device_is_compatible(np, "st,spear1340-pwm")) {
                ret = clk_enable(pc->clk);
-               if (!ret) {
+               if (ret) {
                        clk_unprepare(pc->clk);
                        return ret;
                }