From a845ef7bcda67b711758f251834847db36c91912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sat, 23 Oct 2010 10:06:38 +0000 Subject: [PATCH] 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 --- .../kernel/drivers/audio/ac97/auich/auich.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c index 6af59163a8..5a84dc09bb 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c +++ b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c @@ -188,25 +188,26 @@ auich_stream_set_audioparms(auich_stream *stream, uint8 channels, status_t auich_stream_commit_parms(auich_stream *stream) { - uint32 *page; - uint32 i; + uint32 *page; + uint32 i; LOG(("auich_stream_commit_parms\n")); auich_reg_write_8(&stream->card->config, stream->base + AUICH_REG_X_CR, 0); snooze(10000); // 10 ms - auich_reg_write_8(&stream->card->config, stream->base + AUICH_REG_X_CR, CR_RR); - for (i = 10000; i>=0; i--) { - if (0 == auich_reg_read_8(&stream->card->config, stream->base + AUICH_REG_X_CR)) { + auich_reg_write_8(&stream->card->config, + stream->base + AUICH_REG_X_CR, CR_RR); + 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)); break; } spin(1); } - if (i < 0) { - LOG(("channel reset failed after 10ms\n")); - } + if (i == 0) + PRINT(("channel reset failed after 10ms\n")); page = stream->dmaops_log_base;