From: Uwe Kleine-König Date: Thu, 3 Oct 2024 11:42:17 +0000 (+0200) Subject: pwm: stm32: Fix error checking for a regmap_read() call X-Git-Url: https://repo.jachan.dev/J-linux.git/commitdiff_plain/9c918959e198d25bd3d55068331312812406dec2 pwm: stm32: Fix error checking for a regmap_read() call Without first assigning ret, it always evaluates to zero because otherwise this code isn't reached. So assign the return code of regmap_read() to ret to make the following error path do something. This issue was spotted by Coverity. Reported-by: Kees Bakker Link: https://lore.kernel.org/linux-pwm/b0199625-9dbb-414b-8948-26ad86fd2740@ijzerbout.nl Fixes: deaba9cff809 ("pwm: stm32: Implementation of the waveform callbacks") Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20241003114216.163715-2-u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König --- diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c index d2c1085aee74..b889e64522c3 100644 --- a/drivers/pwm/pwm-stm32.c +++ b/drivers/pwm/pwm-stm32.c @@ -334,7 +334,7 @@ static int stm32_pwm_write_waveform(struct pwm_chip *chip, goto out; } - regmap_read(priv->regmap, TIM_ARR, &arr); + ret = regmap_read(priv->regmap, TIM_ARR, &arr); if (ret) goto out;