From: Hari Prasath Gujulan Elango <Hari.PrasathGE@microchip.com>
To: <thierry.reding@gmail.com>, <u.kleine-koenig@pengutronix.de>,
<nicolas.ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
<claudiu.beznea@tuxon.dev>
Cc: <linux-pwm@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Hari Prasath Gujulan Elango <Hari.PrasathGE@microchip.com>
Subject: [PATCH] pwm: atmel: add missing clk_disable_unprepare()
Date: Tue, 22 Aug 2023 12:34:41 +0530 [thread overview]
Message-ID: <20230822070441.22170-1-Hari.PrasathGE@microchip.com> (raw)
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@microchip.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
next reply other threads:[~2023-08-22 7:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 7:04 Hari Prasath Gujulan Elango [this message]
2023-08-23 4:59 ` [PATCH] pwm: atmel: add missing clk_disable_unprepare() claudiu beznea
2023-08-25 3:04 ` Hari.PrasathGE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230822070441.22170-1-Hari.PrasathGE@microchip.com \
--to=hari.prasathge@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox