diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-05-13 14:44:07 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-05-14 02:41:40 -0400 |
commit | 1b1cc7f21c51cc81992a547b59e174dd8c44d1bd (patch) | |
tree | b1e9ee0cc5d8132078a5d5557e1292d0049fb5aa /sound/pci | |
parent | b452e08e73c0e3dbb0be82130217be4b7084299e (diff) |
ALSA: riptide: postfix increment and off by one
With a postfix increment these variables are incremented beyond
CMDIF_TIMEOUT / MAX_WRITE_RETRY.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/riptide/riptide.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 6f1034417a02..e51a5ef1954d 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -889,7 +889,7 @@ static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm, | |||
889 | spin_lock_irqsave(&cif->lock, irqflags); | 889 | spin_lock_irqsave(&cif->lock, irqflags); |
890 | while (i++ < CMDIF_TIMEOUT && !IS_READY(cif->hwport)) | 890 | while (i++ < CMDIF_TIMEOUT && !IS_READY(cif->hwport)) |
891 | udelay(10); | 891 | udelay(10); |
892 | if (i >= CMDIF_TIMEOUT) { | 892 | if (i > CMDIF_TIMEOUT) { |
893 | err = -EBUSY; | 893 | err = -EBUSY; |
894 | goto errout; | 894 | goto errout; |
895 | } | 895 | } |
@@ -907,8 +907,10 @@ static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm, | |||
907 | WRITE_PORT_ULONG(cmdport->data1, cmd); /* write cmd */ | 907 | WRITE_PORT_ULONG(cmdport->data1, cmd); /* write cmd */ |
908 | if ((flags & RESP) && ret) { | 908 | if ((flags & RESP) && ret) { |
909 | while (!IS_DATF(cmdport) && | 909 | while (!IS_DATF(cmdport) && |
910 | time++ < CMDIF_TIMEOUT) | 910 | time < CMDIF_TIMEOUT) { |
911 | udelay(10); | 911 | udelay(10); |
912 | time++; | ||
913 | } | ||
912 | if (time < CMDIF_TIMEOUT) { /* read response */ | 914 | if (time < CMDIF_TIMEOUT) { /* read response */ |
913 | ret->retlongs[0] = | 915 | ret->retlongs[0] = |
914 | READ_PORT_ULONG(cmdport->data1); | 916 | READ_PORT_ULONG(cmdport->data1); |
@@ -1454,7 +1456,7 @@ static int snd_riptide_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1454 | SEND_GPOS(cif, 0, data->id, &rptr); | 1456 | SEND_GPOS(cif, 0, data->id, &rptr); |
1455 | udelay(1); | 1457 | udelay(1); |
1456 | } while (i != rptr.retlongs[1] && j++ < MAX_WRITE_RETRY); | 1458 | } while (i != rptr.retlongs[1] && j++ < MAX_WRITE_RETRY); |
1457 | if (j >= MAX_WRITE_RETRY) | 1459 | if (j > MAX_WRITE_RETRY) |
1458 | snd_printk(KERN_ERR "Riptide: Could not stop stream!"); | 1460 | snd_printk(KERN_ERR "Riptide: Could not stop stream!"); |
1459 | break; | 1461 | break; |
1460 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1462 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
@@ -1783,7 +1785,7 @@ snd_riptide_codec_write(struct snd_ac97 *ac97, unsigned short reg, | |||
1783 | SEND_SACR(cif, val, reg); | 1785 | SEND_SACR(cif, val, reg); |
1784 | SEND_RACR(cif, reg, &rptr); | 1786 | SEND_RACR(cif, reg, &rptr); |
1785 | } while (rptr.retwords[1] != val && i++ < MAX_WRITE_RETRY); | 1787 | } while (rptr.retwords[1] != val && i++ < MAX_WRITE_RETRY); |
1786 | if (i == MAX_WRITE_RETRY) | 1788 | if (i > MAX_WRITE_RETRY) |
1787 | snd_printdd("Write AC97 reg failed\n"); | 1789 | snd_printdd("Write AC97 reg failed\n"); |
1788 | } | 1790 | } |
1789 | 1791 | ||