amdsbwd: fix nonsensical timeout calculations

in case when sub-second interval is being programmed

Found by:	clang static analyzer
MFC after:	4 days
This commit is contained in:
avg 2010-05-31 09:07:23 +00:00
parent bec30888be
commit b70d66885e

View File

@ -230,10 +230,10 @@ amdsbwd_event(void *arg, unsigned int cmd, int *error)
cmd &= WD_INTERVAL;
if (cmd < WD_TO_1SEC)
cmd = 0;
timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick;
if (timeout > sc->max_ticks)
timeout = sc->max_ticks;
if (cmd) {
timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick;
if (timeout > sc->max_ticks)
timeout = sc->max_ticks;
if (timeout != sc->timeout) {
amdsbwd_tmr_set(sc, timeout);
if (!sc->active)