Skip to content

Commit 5dac9f8

Browse files
error27tiwai
authored andcommitted
ALSA: pci: lx6464es: fix a debug loop
This loop accidentally reuses the "i" iterator for both the inside and the outside loop. The value of MAX_STREAM_BUFFER is 5. I believe that chip->rmh.stat_len is in the 2-12 range. If the value of .stat_len is 4 or more then it will loop exactly one time, but if it's less then it is a forever loop. It looks like it was supposed to combined into one loop where conditions are checked. Fixes: 8e63200 ("ALSA: lx_core: Remove useless #if 0 .. #endif") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/Y9jnJTis/mRFJAQp@kili Signed-off-by: Takashi Iwai <[email protected]>
1 parent c7a806d commit 5dac9f8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sound/pci/lx6464es/lx_core.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -493,12 +493,11 @@ int lx_buffer_ask(struct lx6464es *chip, u32 pipe, int is_capture,
493493
dev_dbg(chip->card->dev,
494494
"CMD_08_ASK_BUFFERS: needed %d, freed %d\n",
495495
*r_needed, *r_freed);
496-
for (i = 0; i < MAX_STREAM_BUFFER; ++i) {
497-
for (i = 0; i != chip->rmh.stat_len; ++i)
498-
dev_dbg(chip->card->dev,
499-
" stat[%d]: %x, %x\n", i,
500-
chip->rmh.stat[i],
501-
chip->rmh.stat[i] & MASK_DATA_SIZE);
496+
for (i = 0; i < MAX_STREAM_BUFFER && i < chip->rmh.stat_len;
497+
++i) {
498+
dev_dbg(chip->card->dev, " stat[%d]: %x, %x\n", i,
499+
chip->rmh.stat[i],
500+
chip->rmh.stat[i] & MASK_DATA_SIZE);
502501
}
503502
}
504503

0 commit comments

Comments
 (0)