Skip to contentSkip to conversation

pwm: spear: Fix enable pwm output

PATCH In review Axel Lin 3 participants 3 messages Mar 30, 2013 – Apr 1, 2013 PWM

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

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

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.

---
 drivers/pwm/pwm-spear.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-spear.c +2 -2
index 69a2d9e..d836940 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);
@@ -214,7 +214,7 @@ static int spear_pwm_probe(struct platform_device *pdev)
 
 	if (of_device_is_compatible(np, "st,spear1340-pwm")) {
 		ret = clk_enable(pc->clk);
-		if (!ret) {
+		if (ret) {
 			clk_unprepare(pc->clk);
 			return ret;
 		}
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 7 lines · Axel Lin

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.

---
 drivers/pwm/pwm-spear.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

I am so sorry. clk_prepare also has the same issue :( Please fix that too and i will ack it ASAP.

@Shiraz: Any idea how they went through?

#2 lore raw
Quoted 9 lines · Viresh Kumar
Quoted 7 lines · Axel Lin

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.

---
 drivers/pwm/pwm-spear.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 4 lines

I am so sorry. clk_prepare also has the same issue :( Please fix that too and i will ack it ASAP.

@Shiraz: Any idea how they went through?

I don't remember how :(, surely a mistake which escaped tests also.

--
regards
Shiraz