lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230822070441.22170-1-Hari.PrasathGE@microchip.com>
Date:   Tue, 22 Aug 2023 12:34:41 +0530
From:   Hari Prasath Gujulan Elango <Hari.PrasathGE@...rochip.com>
To:     <thierry.reding@...il.com>, <u.kleine-koenig@...gutronix.de>,
        <nicolas.ferre@...rochip.com>, <alexandre.belloni@...tlin.com>,
        <claudiu.beznea@...on.dev>
CC:     <linux-pwm@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>,
        Hari Prasath Gujulan Elango <Hari.PrasathGE@...rochip.com>
Subject: [PATCH] pwm: atmel: add missing clk_disable_unprepare()

Fix the below smatch warning:

drivers/pwm/pwm-atmel-hlcdc.c:167 atmel_hlcdc_pwm_apply() warn: 'new_clk' from clk_prepare_enable() not released on lines: 112,137,142,149.

Signed-off-by: Hari Prasath Gujulan Elango <Hari.PrasathGE@...rochip.com>
---
 drivers/pwm/pwm-atmel-hlcdc.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
index 96a709a9d49a..ce46f6c74a14 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -108,8 +108,10 @@ static int atmel_hlcdc_pwm_apply(struct pwm_chip *c, struct pwm_device *pwm,
 						 ATMEL_HLCDC_CFG(0),
 						 ATMEL_HLCDC_CLKPWMSEL,
 						 gencfg);
-			if (ret)
+			if (ret) {
+				clk_disable_unprepare(new_clk);
 				return ret;
+			}
 		}
 
 		do_div(pwmcval, state->period);
@@ -133,20 +135,27 @@ static int atmel_hlcdc_pwm_apply(struct pwm_chip *c, struct pwm_device *pwm,
 					 ATMEL_HLCDC_PWMPS_MASK |
 					 ATMEL_HLCDC_PWMPOL,
 					 pwmcfg);
-		if (ret)
+		if (ret) {
+			clk_disable_unprepare(new_clk);
 			return ret;
+		}
 
 		ret = regmap_write(hlcdc->regmap, ATMEL_HLCDC_EN,
 				   ATMEL_HLCDC_PWM);
-		if (ret)
+		if (ret) {
+			clk_disable_unprepare(new_clk);
 			return ret;
+		}
 
 		ret = regmap_read_poll_timeout(hlcdc->regmap, ATMEL_HLCDC_SR,
 					       status,
 					       status & ATMEL_HLCDC_PWM,
 					       10, 0);
-		if (ret)
+		if (ret) {
+			clk_disable_unprepare(new_clk);
 			return ret;
+		}
+
 	} else {
 		ret = regmap_write(hlcdc->regmap, ATMEL_HLCDC_DIS,
 				   ATMEL_HLCDC_PWM);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ