Commit 5dac9f8d authored by Dan Carpenter's avatar Dan Carpenter Committed by Takashi Iwai
Browse files

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: 8e632006 ("ALSA: lx_core: Remove useless #if 0 .. #endif")
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/Y9jnJTis/mRFJAQp@kili


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c7a806d9
Loading
Loading
Loading
Loading
+5 −6
Original line number Original line Diff line number Diff line
@@ -493,10 +493,9 @@ int lx_buffer_ask(struct lx6464es *chip, u32 pipe, int is_capture,
		dev_dbg(chip->card->dev,
		dev_dbg(chip->card->dev,
			"CMD_08_ASK_BUFFERS: needed %d, freed %d\n",
			"CMD_08_ASK_BUFFERS: needed %d, freed %d\n",
			    *r_needed, *r_freed);
			    *r_needed, *r_freed);
		for (i = 0; i < MAX_STREAM_BUFFER; ++i) {
		for (i = 0; i < MAX_STREAM_BUFFER && i < chip->rmh.stat_len;
			for (i = 0; i != chip->rmh.stat_len; ++i)
		     ++i) {
				dev_dbg(chip->card->dev,
			dev_dbg(chip->card->dev, "  stat[%d]: %x, %x\n", i,
					"  stat[%d]: %x, %x\n", i,
				chip->rmh.stat[i],
				chip->rmh.stat[i],
				chip->rmh.stat[i] & MASK_DATA_SIZE);
				chip->rmh.stat[i] & MASK_DATA_SIZE);
		}
		}