From: Axel Lin Date: Sat, 30 Mar 2013 12:43:22 +0000 (+0800) Subject: pwm: spear: Fix checking return value of clk_enable() and clk_prepare() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=563861cd633ae52932843477bb6ca3f1c9e2f78b;p=linux-beck.git 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 Cc: stable@vger.kernel.org Acked-by: Viresh Kumar Signed-off-by: Thierry Reding --- 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; }