From 9c918959e198d25bd3d55068331312812406dec2 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Thu, 3 Oct 2024 13:42:17 +0200 Subject: pwm: stm32: Fix error checking for a regmap_read() call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- drivers/pwm/pwm-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/pwm/pwm-stm32.c') 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; -- cgit