summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorariff <ariff@FreeBSD.org>2007-07-11 14:27:45 +0000
committerariff <ariff@FreeBSD.org>2007-07-11 14:27:45 +0000
commit6354f6714f8e25ed74f8879e938aa374c6a6216a (patch)
treeb6542164c00ab594b5f10aafb6e9b8c9820cfa55 /sys
parentff9bf4b792638d7157d3edd6df71e2a8c02e5ba6 (diff)
downloadFreeBSD-src-6354f6714f8e25ed74f8879e938aa374c6a6216a.zip
FreeBSD-src-6354f6714f8e25ed74f8879e938aa374c6a6216a.tar.gz
Protect against divide by zero while calculating bus speed due to
possible broken kernel timecounter. Reported/Tested by: silby Approved by: re (hrs) MFC after: 1 day
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sound/pci/ich.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/sound/pci/ich.c b/sys/dev/sound/pci/ich.c
index cebf0b6..64e2eec 100644
--- a/sys/dev/sound/pci/ich.c
+++ b/sys/dev/sound/pci/ich.c
@@ -783,7 +783,11 @@ ich_calibrate(void *arg)
return;
}
- actual_48k_rate = ((uint64_t)ch->blksz * 250000) / wait_us;
+ /* Just in case the timecounter screwed. It is possible, really. */
+ if (wait_us > 0)
+ actual_48k_rate = ((uint64_t)ch->blksz * 250000) / wait_us;
+ else
+ actual_48k_rate = 48000;
if (actual_48k_rate < 47500 || actual_48k_rate > 48500) {
sc->ac97rate = actual_48k_rate;
OpenPOWER on IntegriCloud