avoid an infinite loop with the variable loop i

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39062 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2010-10-23 10:06:38 +00:00
parent 868d2a2ed5
commit a845ef7bcd

View File

@ -188,25 +188,26 @@ auich_stream_set_audioparms(auich_stream *stream, uint8 channels,
status_t status_t
auich_stream_commit_parms(auich_stream *stream) auich_stream_commit_parms(auich_stream *stream)
{ {
uint32 *page; uint32 *page;
uint32 i; uint32 i;
LOG(("auich_stream_commit_parms\n")); LOG(("auich_stream_commit_parms\n"));
auich_reg_write_8(&stream->card->config, stream->base + AUICH_REG_X_CR, 0); auich_reg_write_8(&stream->card->config, stream->base + AUICH_REG_X_CR, 0);
snooze(10000); // 10 ms snooze(10000); // 10 ms
auich_reg_write_8(&stream->card->config, stream->base + AUICH_REG_X_CR, CR_RR); auich_reg_write_8(&stream->card->config,
for (i = 10000; i>=0; i--) { stream->base + AUICH_REG_X_CR, CR_RR);
if (0 == auich_reg_read_8(&stream->card->config, stream->base + AUICH_REG_X_CR)) { for (i = 10000; i > 0; i--) {
if (0 == auich_reg_read_8(&stream->card->config,
stream->base + AUICH_REG_X_CR)) {
LOG(("channel reset finished, %x, %d\n", stream->base, i)); LOG(("channel reset finished, %x, %d\n", stream->base, i));
break; break;
} }
spin(1); spin(1);
} }
if (i < 0) { if (i == 0)
LOG(("channel reset failed after 10ms\n")); PRINT(("channel reset failed after 10ms\n"));
}
page = stream->dmaops_log_base; page = stream->dmaops_log_base;