From 3c0a6058b518f7d5dfbbadc9e857cc605632264b Mon Sep 17 00:00:00 2001 From: Fabian Pflug Date: Thu, 21 Dec 2023 15:27:42 +0100 Subject: [PATCH] drivers: pwm: stm32: Catch overflows in 2-channel capture When not using 4 channel capture, overflows were never reported to the application, because the check was in the four_channel_capture_support branch. Signed-off-by: Fabian Pflug --- drivers/pwm/pwm_stm32.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pwm/pwm_stm32.c b/drivers/pwm/pwm_stm32.c index 4d899b19fe..c8e44633ad 100644 --- a/drivers/pwm/pwm_stm32.c +++ b/drivers/pwm/pwm_stm32.c @@ -732,11 +732,11 @@ static void pwm_stm32_isr(const struct device *dev) /* Still waiting for a complete capture */ return; } + } - if (cpt->overflows) { - LOG_ERR("counter overflow during PWM capture"); - status = -ERANGE; - } + if (cpt->overflows) { + LOG_ERR("counter overflow during PWM capture"); + status = -ERANGE; } if (!cpt->continuous) {