drivers: can: Fixed timeout values comparison

Trivial fix of compilation error "invalid operands to binary "
when CONFIG_CAN_AUTO_BUS_OFF_RECOVERY = n

Fixes #40290

Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
This commit is contained in:
Lucas Dietrich 2021-11-15 19:06:46 +01:00 committed by Christopher Friedt
commit f7f0bc7022
2 changed files with 3 additions and 3 deletions

View file

@ -469,9 +469,9 @@ int mcux_flexcan_recover(const struct device *dev, k_timeout_t timeout)
start_time = k_uptime_ticks(); start_time = k_uptime_ticks();
config->base->CTRL1 &= ~CAN_CTRL1_BOFFREC_MASK; config->base->CTRL1 &= ~CAN_CTRL1_BOFFREC_MASK;
if (timeout != K_NO_WAIT) { if (!K_TIMEOUT_EQ(timeout, K_NO_WAIT)) {
while (mcux_flexcan_get_state(dev, NULL) == CAN_BUS_OFF) { while (mcux_flexcan_get_state(dev, NULL) == CAN_BUS_OFF) {
if (timeout != K_FOREVER && if (!K_TIMEOUT_EQ(timeout, K_FOREVER) &&
k_uptime_ticks() - start_time >= timeout.ticks) { k_uptime_ticks() - start_time >= timeout.ticks) {
ret = CAN_TIMEOUT; ret = CAN_TIMEOUT;
} }

View file

@ -593,7 +593,7 @@ int can_stm32_recover(const struct device *dev, k_timeout_t timeout)
start_time = k_uptime_ticks(); start_time = k_uptime_ticks();
while (can->ESR & CAN_ESR_BOFF) { while (can->ESR & CAN_ESR_BOFF) {
if (timeout != K_FOREVER && if (!K_TIMEOUT_EQ(timeout, K_FOREVER) &&
k_uptime_ticks() - start_time >= timeout.ticks) { k_uptime_ticks() - start_time >= timeout.ticks) {
goto done; goto done;
} }