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 <kees@ijzerbout.nl>
Link: https://lore.kernel.org/linux-pwm/b0199625-9dbb-414b-8948-26ad86fd2740@ijzerbout.nl
Fixes: deaba9cff8 ("pwm: stm32: Implementation of the waveform callbacks")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20241003114216.163715-2-u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
This commit is contained in:
Uwe Kleine-König 2024-10-03 13:42:17 +02:00 committed by Uwe Kleine-König
parent dab9cd4b8e
commit 9c918959e1

View File

@ -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;