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 <christian.taedcke@lemonbeat.com>
This commit is contained in:
Christian Taedcke 2021-03-23 16:38:04 +01:00 committed by Maureen Helm
commit ebcc316e1c

View file

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