Linux Kernels

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

This change “pwm: spear: Fix checking return value of clk_enable() and clk_prepare()” (commit 563861c) in Linux kernel is authored by Axel Lin <axel.lin [at] ingics.com> on Sat Mar 30 20:43:22 2013 +0800.

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

The change “pwm: spear: Fix checking return value of clk_enable() and clk_prepare()” introduces changes as follows.

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.

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>

Linux kernel releases containing commit 563861c

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "pwm: spear: Fix checking return value of clk_enable() and clk_prepare()"

There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/pwm/pwm-spear.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
 
diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
index 69a2d9eb34db..3223b57e8f9c 100644
--- a/drivers/pwm/pwm-spear.c
+++ b/drivers/pwm/pwm-spear.c
@@ -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;
 		}

The commit for this change in Linux stable tree is 563861c (patch).

Last modified: 2020/01/11 09:44