aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-stm32.c
diff options
context:
space:
mode:
authorMingwei Zheng <[email protected]>2024-12-15 22:47:52 +0000
committerUwe Kleine-König <[email protected]>2025-01-17 09:41:56 +0000
commite8c59791ebb60790c74b2c3ab520f04a8a57219a (patch)
tree7430aaed548249d146b74d0d953086d3bce4bd29 /drivers/pwm/pwm-stm32.c
parentdt-bindings: pwm: Correct indentation and style in DTS example (diff)
downloadkernel-e8c59791ebb60790c74b2c3ab520f04a8a57219a.tar.gz
kernel-e8c59791ebb60790c74b2c3ab520f04a8a57219a.zip
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 <[email protected]> Signed-off-by: Jiasheng Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
Diffstat (limited to 'drivers/pwm/pwm-stm32.c')
-rw-r--r--drivers/pwm/pwm-stm32.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 17e591f61efb..a59de4de18b6 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)