[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241215224752.220318-1-zmw12306@gmail.com>
Date: Sun, 15 Dec 2024 17:47:52 -0500
From: Mingwei Zheng <zmw12306@...il.com>
To: fabrice.gasnier@...s.st.com,
ukleinek@...nel.org,
mcoquelin.stm32@...il.com,
alexandre.torgue@...s.st.com,
thierry.reding@...il.com,
p.zabel@...gutronix.de
Cc: linux-pwm@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Mingwei Zheng <zmw12306@...il.com>,
Jiasheng Jiang <jiashengjiangcool@...il.com>
Subject: [PATCH] pwm: stm32: Add check for clk_enable()
Add check for the return value of clk_enable() to catch the potential
error.
Fixes: 19f1016ea960 ("pwm: stm32: Fix enable count for clk in .probe()")
Signed-off-by: Mingwei Zheng <zmw12306@...il.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
---
drivers/pwm/pwm-stm32.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index b889e64522c3..b94d186e3c0c 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -858,8 +858,11 @@ static int stm32_pwm_probe(struct platform_device *pdev)
chip->ops = &stm32pwm_ops;
/* Initialize clock refcount to number of enabled PWM channels. */
- for (i = 0; i < num_enabled; i++)
- clk_enable(priv->clk);
+ for (i = 0; i < num_enabled; i++) {
+ ret = clk_enable(priv->clk);
+ if (ret)
+ return ret;
+ }
ret = devm_pwmchip_add(dev, chip);
if (ret < 0)
--
2.34.1
Powered by blists - more mailing lists