Skip to content

Commit e8c5979

Browse files
zmw12306Uwe Kleine-König
authored andcommitted
pwm: stm32: Add check for clk_enable()
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 <[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]>
1 parent 78dcad6 commit e8c5979

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/pwm/pwm-stm32.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,11 @@ static int stm32_pwm_probe(struct platform_device *pdev)
858858
chip->ops = &stm32pwm_ops;
859859

860860
/* Initialize clock refcount to number of enabled PWM channels. */
861-
for (i = 0; i < num_enabled; i++)
862-
clk_enable(priv->clk);
861+
for (i = 0; i < num_enabled; i++) {
862+
ret = clk_enable(priv->clk);
863+
if (ret)
864+
return ret;
865+
}
863866

864867
ret = devm_pwmchip_add(dev, chip);
865868
if (ret < 0)

0 commit comments

Comments
 (0)