pwm: stm32: Add check for clk_enable()

Add check for the return value of clk_enable() to catch the potential
error.

Fixes: 19f1016ea9 ("pwm: stm32: Fix enable count for clk in .probe()")
Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Link: https://lore.kernel.org/r/20241215224752.220318-1-zmw12306@gmail.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
This commit is contained in:
Mingwei Zheng
2024-12-15 17:47:52 -05:00
committed by Uwe Kleine-König
parent 78dcad6daa
commit e8c59791eb
+5 -2
View File
@@ -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)