summaryrefslogtreecommitdiffstats
path: root/sys/dev/amdsbwd/amdsbwd.c
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2010-05-31 09:07:23 +0000
committeravg <avg@FreeBSD.org>2010-05-31 09:07:23 +0000
commitb70d66885e2662de149bb4cfc79ab714512295a3 (patch)
treebead7a52d069d3c3caabc8b020073af8bf029d18 /sys/dev/amdsbwd/amdsbwd.c
parentbec30888be27ad2dbfb0a19202250a22f73f2375 (diff)
downloadFreeBSD-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.c6
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)
OpenPOWER on IntegriCloud