driver: timer: npcx: fix dead code flow for K_TICKS_FOREVER.

Fix dead code flow if ticks is K_TICKS_FOREVER.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
This commit is contained in:
Mulin Chao 2021-03-07 18:29:14 -08:00 committed by Anas Nashif
commit 291c61fd47

View file

@ -134,13 +134,12 @@ static int npcx_itim_start_evt_tmr_by_tick(int32_t ticks)
* Get desired cycles of event timer from the requested ticks which * Get desired cycles of event timer from the requested ticks which
* round up to next tick boundary. * round up to next tick boundary.
*/ */
if (ticks <= 0) {
ticks = 1;
}
if (ticks == K_TICKS_FOREVER) { if (ticks == K_TICKS_FOREVER) {
cyc_evt_timeout = NPCX_ITIM32_MAX_CNT; cyc_evt_timeout = NPCX_ITIM32_MAX_CNT;
} else { } else {
if (ticks <= 0) {
ticks = 1;
}
cyc_evt_timeout = MIN(EVT_CYCLES_FROM_TICKS(ticks), cyc_evt_timeout = MIN(EVT_CYCLES_FROM_TICKS(ticks),
NPCX_ITIM32_MAX_CNT); NPCX_ITIM32_MAX_CNT);
} }