From ebcc316e1cef9608ca0a74d9f39a6c67b2c86c0d Mon Sep 17 00:00:00 2001 From: Christian Taedcke Date: Tue, 23 Mar 2021 16:38:04 +0100 Subject: [PATCH] drivers: watchdog: mcux_wwdt: fix validating window min vs max The comparison was inverted before so configuring a valid window providing min and max was not possible. Now the comparison is corrected and only done if the watchdog is used in windowed mode. Signed-off-by: Christian Taedcke --- drivers/watchdog/wdt_mcux_wwdt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/wdt_mcux_wwdt.c b/drivers/watchdog/wdt_mcux_wwdt.c index c8637529669..207f5c4c26e 100644 --- a/drivers/watchdog/wdt_mcux_wwdt.c +++ b/drivers/watchdog/wdt_mcux_wwdt.c @@ -97,8 +97,9 @@ static int mcux_wwdt_install_timeout(const struct device *dev, } if ((data->wwdt_config.timeoutValue < MIN_TIMEOUT) || - (data->wwdt_config.timeoutValue > data->wwdt_config.windowValue)) { - LOG_ERR("Invalid timeout"); + ((data->wwdt_config.windowValue != 0xFFFFFFU) && + (data->wwdt_config.timeoutValue < + data->wwdt_config.windowValue))) { return -EINVAL; }