Skip to contentSkip to conversation

ALSA: test off by one in setsamplerate()

PATCH In review Roel Kluin 2 participants 2 messages Dec 27, 2009 – Dec 28, 2009 Sound

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 ALSA: test off by one in setsamplerate()

With `while (i++ < MAX_WRITE_RETRY)' i reaches MAX_WRITE_RETRY + 1 after the loop

---
 sound/pci/riptide/riptide.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/pci/riptide/riptide.c +1 -1
index b5ca02e..e66ef2b 100644
@@ -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;
#1 lore raw

At Sun, 27 Dec 2009 22:26:47 +0100,

Quoted 4 lines · Roel Kluin

With `while (i++ < MAX_WRITE_RETRY)' i reaches MAX_WRITE_RETRY + 1 after the loop

Applied now. Thanks.

Takashi

Quoted 18 lines
---
 sound/pci/riptide/riptide.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/pci/riptide/riptide.c +1 -1
index b5ca02e..e66ef2b 100644
@@ -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;