pwm: stm32: Add check for clk_enable()

BugLink: https://bugs.launchpad.net/bugs/2111953

[ Upstream commit e8c59791ebb60790c74b2c3ab520f04a8a57219a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
Signed-off-by: Mehmet Basaran <mehmet.basaran@canonical.com>
This commit is contained in:
Mingwei Zheng
2024-12-15 17:47:52 -05:00
committed by Mehmet Basaran
parent 5f6553c08d
commit cf20a3e3c6
+5 -2
View File
@@ -683,8 +683,11 @@ static int stm32_pwm_probe(struct platform_device *pdev)
/* 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, &priv->chip);
if (ret < 0)