svn commit: r208670 - head/sys/dev/amdsbwd
Andriy Gapon
avg at FreeBSD.org
Mon May 31 09:07:23 UTC 2010
Author: avg
Date: Mon May 31 09:07:23 2010
New Revision: 208670
URL: http://svn.freebsd.org/changeset/base/208670
Log:
amdsbwd: fix nonsensical timeout calculations
in case when sub-second interval is being programmed
Found by: clang static analyzer
MFC after: 4 days
Modified:
head/sys/dev/amdsbwd/amdsbwd.c
Modified: head/sys/dev/amdsbwd/amdsbwd.c
==============================================================================
--- head/sys/dev/amdsbwd/amdsbwd.c Mon May 31 09:06:03 2010 (r208669)
+++ head/sys/dev/amdsbwd/amdsbwd.c Mon May 31 09:07:23 2010 (r208670)
@@ -230,10 +230,10 @@ amdsbwd_event(void *arg, unsigned int cm
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)
More information about the svn-src-all
mailing list