Skip to content

Commit

Permalink
ALSA: test off by one in setsamplerate()
Browse files Browse the repository at this point in the history
With `while (i++ < MAX_WRITE_RETRY)' i reaches MAX_WRITE_RETRY + 1 after the loop

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
RoelKluin authored and tiwai committed Dec 28, 2009
1 parent dfb12ee commit 9980c62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/pci/riptide/riptide.c
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate)
rptr.retwords[2] != M &&
rptr.retwords[3] != N &&
i++ < MAX_WRITE_RETRY);
if (i == MAX_WRITE_RETRY) {
if (i > MAX_WRITE_RETRY) {
snd_printdd("sent samplerate %d: %d failed\n",
*intdec, rate);
return -EIO;
Expand Down

0 comments on commit 9980c62

Please sign in to comment.