Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Fix:



details:   https://anonhg.NetBSD.org/src/rev/45cd51e9f724
branches:  trunk
changeset: 771989:45cd51e9f724
user:      jdc <jdc%NetBSD.org@localhost>
date:      Mon Dec 12 18:28:34 2011 +0000

description:
Fix:
  panic: kernel diagnostic assertion "usec >= 0 && usec < 1000000" failed: file "/usr/src/sys/kern/subr_time.c", line 92
by using timeradd(), rather than our own code, in the timeout calculating
loop.  Idea from joerg@.

diffstat:

 sys/dev/ic/isp_netbsd.c |  15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diffs (40 lines):

diff -r 4d63c0e22a7b -r 45cd51e9f724 sys/dev/ic/isp_netbsd.c
--- a/sys/dev/ic/isp_netbsd.c   Mon Dec 12 17:07:42 2011 +0000
+++ b/sys/dev/ic/isp_netbsd.c   Mon Dec 12 18:28:34 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.84 2010/09/20 03:52:45 mjacob Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.85 2011/12/12 18:28:34 jdc Exp $ */
 /*
  * Platform (NetBSD) dependent common attachment code for Qlogic adapters.
  */
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.84 2010/09/20 03:52:45 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.85 2011/12/12 18:28:34 jdc Exp $");
 
 #include <dev/ic/isp_netbsd.h>
 #include <dev/ic/isp_ioctl.h>
@@ -1598,17 +1598,14 @@
        microtime(&start);
        if (isp->isp_osinfo.mbox_sleep_ok) {
                int to;
-               struct timeval tv;
+               struct timeval tv, utv;
 
                tv.tv_sec = 0;
                tv.tv_usec = 0;
                for (olim = 0; olim < maxc; olim++) {
-                       tv.tv_sec += (usecs / 1000000);
-                       tv.tv_usec += (usecs % 1000000);
-                       if (tv.tv_usec >= 100000) {
-                               tv.tv_sec++;
-                               tv.tv_usec -= 1000000;
-                       }
+                       utv.tv_sec = 0;
+                       utv.tv_usec = usecs;
+                       timeradd(&tv, &utv, &tv);
                }
                timeradd(&tv, &start, &tv);
                to = tvhzto(&tv);



Home | Main Index | Thread Index | Old Index