diff options
author | Mingwei Zheng <zmw12306@gmail.com> | 2024-12-06 22:53:18 +0100 |
---|---|---|
committer | Uwe Kleine-König <ukleinek@kernel.org> | 2024-12-18 11:12:05 +0100 |
commit | cce16e7f6216227964cda25f5f23634bce2c500f (patch) | |
tree | 7a5f1823d6f8754fb04640be845a322e57f45ac9 /drivers/pwm | |
parent | dt-bindings: pwm: marvell,berlin-pwm: Convert from txt to yaml (diff) | |
download | linux-cce16e7f6216227964cda25f5f23634bce2c500f.tar.xz linux-cce16e7f6216227964cda25f5f23634bce2c500f.zip |
pwm: stm32-lp: Add check for clk_enable()
Add check for the return value of clk_enable() to catch the potential
error.
We used APP-Miner to find it.
Fixes: e70a540b4e02 ("pwm: Add STM32 LPTimer PWM driver")
Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Link: https://lore.kernel.org/r/20241206215318.3402860-1-zmw12306@gmail.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Diffstat (limited to 'drivers/pwm')
-rw-r--r-- | drivers/pwm/pwm-stm32-lp.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c index 989731256f50..5832dce8ed9d 100644 --- a/drivers/pwm/pwm-stm32-lp.c +++ b/drivers/pwm/pwm-stm32-lp.c @@ -167,8 +167,12 @@ static int stm32_pwm_lp_get_state(struct pwm_chip *chip, regmap_read(priv->regmap, STM32_LPTIM_CR, &val); state->enabled = !!FIELD_GET(STM32_LPTIM_ENABLE, val); /* Keep PWM counter clock refcount in sync with PWM initial state */ - if (state->enabled) - clk_enable(priv->clk); + if (state->enabled) { + int ret = clk_enable(priv->clk); + + if (ret) + return ret; + } regmap_read(priv->regmap, STM32_LPTIM_CFGR, &val); presc = FIELD_GET(STM32_LPTIM_PRESC, val); |