]> Git Repo - linux.git/commitdiff
pwm: stm32: Add check for clk_enable()
authorMingwei Zheng <[email protected]>
Sun, 15 Dec 2024 22:47:52 +0000 (17:47 -0500)
committerUwe Kleine-König <[email protected]>
Fri, 17 Jan 2025 09:41:56 +0000 (10:41 +0100)
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]>
drivers/pwm/pwm-stm32.c

index 17e591f61efb6031b6c47e25c88d252377d0094a..a59de4de18b6e9a06de5afd952241c1844ab149a 100644 (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)
This page took 0.057045 seconds and 4 git commands to generate.