diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index 3cd118281980..2d261b5518c9 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -156,6 +156,10 @@ static unsigned int dw_wdt_get_min_timeout(struct dw_wdt *dw_wdt) break; } + /* For Coverity check */ + if (idx == DW_WDT_NUM_TOPS) + idx = 0; + return dw_wdt->timeouts[idx].sec; } @@ -179,6 +183,9 @@ static unsigned int dw_wdt_get_timeout(struct dw_wdt *dw_wdt) break; } + if (idx == DW_WDT_NUM_TOPS) + idx = 0; + /* * In IRQ mode due to the two stages counter, the actual timeout is * twice greater than the TOP setting.