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
This commit is contained in:
ariff 2007-07-11 14:27:45 +00:00
parent ff9bf4b792
commit 6354f6714f

View File

@ -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;