Skip to contentSkip to conversation

pwm: spear: Fix checking return value of clk_enable() and clk_prepare()

PATCH Applied Axel Lin 3 participants 4 messages Mar 30, 2013 – Apr 2, 2013

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 pwm: spear: Fix checking return value of clk_enable() and clk_prepare()

The logic to check return value of clk_enable() and clk_prepare() is reversed, fix it.

---
This is v3 of "pwm: spear: Fix enable pwm output".
I change the subject line because it also fixes checking return value of clk_prepare().
Also add cc stable.

Axel

 drivers/pwm/pwm-spear.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pwm/pwm-spear.c +3 -3
index 69a2d9e..3223b57 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);
@@ -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;
 		}
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Axel Lin

The logic to check return value of clk_enable() and clk_prepare() is reversed, fix it.

---
This is v3 of "pwm: spear: Fix enable pwm output".
I change the subject line because it also fixes checking return value of clk_prepare().
Also add cc stable.

Quoted 4 lines

Axel

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

Sorry for the delays caused due to me.