Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Mingwei Zheng and committed by
Uwe Kleine-König
cce16e7f 4ccf7e35

+6 -2
+6 -2
drivers/pwm/pwm-stm32-lp.c
··· 167 167 regmap_read(priv->regmap, STM32_LPTIM_CR, &val); 168 168 state->enabled = !!FIELD_GET(STM32_LPTIM_ENABLE, val); 169 169 /* Keep PWM counter clock refcount in sync with PWM initial state */ 170 - if (state->enabled) 171 - clk_enable(priv->clk); 170 + if (state->enabled) { 171 + int ret = clk_enable(priv->clk); 172 + 173 + if (ret) 174 + return ret; 175 + } 172 176 173 177 regmap_read(priv->regmap, STM32_LPTIM_CFGR, &val); 174 178 presc = FIELD_GET(STM32_LPTIM_PRESC, val);