diff options
author | avg <avg@FreeBSD.org> | 2010-05-31 09:07:23 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2010-05-31 09:07:23 +0000 |
commit | b70d66885e2662de149bb4cfc79ab714512295a3 (patch) | |
tree | bead7a52d069d3c3caabc8b020073af8bf029d18 /sys/dev/amdsbwd/amdsbwd.c | |
parent | bec30888be27ad2dbfb0a19202250a22f73f2375 (diff) | |
download | FreeBSD-src-b70d66885e2662de149bb4cfc79ab714512295a3.zip FreeBSD-src-b70d66885e2662de149bb4cfc79ab714512295a3.tar.gz |
amdsbwd: fix nonsensical timeout calculations
in case when sub-second interval is being programmed
Found by: clang static analyzer
MFC after: 4 days
Diffstat (limited to 'sys/dev/amdsbwd/amdsbwd.c')
-rw-r--r-- | sys/dev/amdsbwd/amdsbwd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/amdsbwd/amdsbwd.c b/sys/dev/amdsbwd/amdsbwd.c index 418e194..f5f0f87 100644 --- a/sys/dev/amdsbwd/amdsbwd.c +++ b/sys/dev/amdsbwd/amdsbwd.c @@ -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) |