Skip to contentSkip to conversation

pwm: spear: Fix enable pwm output

PATCH Superseded Axel Lin 2 participants 2 messages Mar 30, 2013 PWM

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 pwm: spear: Fix enable pwm output

The logic to check return value of clk_enable() is reversed, thus when clek_enable() success PWMCR_PWM_ENABLE bit is never set. Fix it.

---
 drivers/pwm/pwm-spear.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-spear.c +1 -1
index 69a2d9e..cccb430 100644
@@ -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);
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 2 lines · Axel Lin

The logic to check return value of clk_enable() is reversed, thus when clek_enable() success PWMCR_PWM_ENABLE bit is never set. Fix it.

s/clek/clk

And write it as:

The logic to check return value of clk_enable() is reversed, thus when clk_enable() passes PWMCR_PWM_ENABLE bit is not set. Fix it.

Quoted 11 lines
---
 drivers/pwm/pwm-spear.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-spear.c +0 -0
index 69a2d9e..cccb430 100644

drivers/pwm/pwm-spear.c static int spear_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) · line 147

Quoted 6 lines
drivers/pwm/pwm-spear.c +1 -1
@@ -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;

This is okay but there is one more mistake like this in this driver. Fix that too.