From 59bb12e8afde3e37eb97bd6de963666f76478514 Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Thu, 22 May 2008 20:11:04 +0000 Subject: never schedule a timer for a negative time, if in the past schedule short delay. please commit deraadt@ --- sys/dev/atapiscsi/atapiscsi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/dev/atapiscsi') diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c index 6f561d7e346..41afc95e3cc 100644 --- a/sys/dev/atapiscsi/atapiscsi.c +++ b/sys/dev/atapiscsi/atapiscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atapiscsi.c,v 1.79 2007/11/06 01:05:35 krw Exp $ */ +/* $OpenBSD: atapiscsi.c,v 1.80 2008/05/22 20:11:03 drahn Exp $ */ /* * This code is derived from code with the copyright below. @@ -684,8 +684,12 @@ wdc_atapi_the_machine(chp, xfer, ctxt) } if (retargs.expect_irq) { + int timeout_period; chp->ch_flags |= WDCF_IRQ_WAIT; - timeout_add(&chp->ch_timo, xfer->endticks - ticks); + timeout_period = xfer->endticks - ticks; + if (timeout_period < 1) + timeout_period = 1; + timeout_add(&chp->ch_timo, timeout_period); return; } -- cgit v1.2.3