diff options
author | ariff <ariff@FreeBSD.org> | 2007-07-11 14:27:45 +0000 |
---|---|---|
committer | ariff <ariff@FreeBSD.org> | 2007-07-11 14:27:45 +0000 |
commit | 6354f6714f8e25ed74f8879e938aa374c6a6216a (patch) | |
tree | b6542164c00ab594b5f10aafb6e9b8c9820cfa55 | |
parent | ff9bf4b792638d7157d3edd6df71e2a8c02e5ba6 (diff) | |
download | FreeBSD-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
-rw-r--r-- | sys/dev/sound/pci/ich.c | 6 |
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; |