Skip to content

Commit

Permalink
pwm: stm32: Add check for clk_enable()
Browse files Browse the repository at this point in the history
Add check for the return value of clk_enable() to catch the potential
error.

Fixes: 19f1016 ("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>
  • Loading branch information
Mingwei Zheng authored and Uwe Kleine-König committed Jan 17, 2025
1 parent 78dcad6 commit e8c5979
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/pwm/pwm-stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e8c5979

Please sign in to comment.