ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()

The loop timeout doesn't work because it's a post op and ends with "tmo"
set to -1.  I changed it from a post-op to a pre-op and I changed the
initial the starting value from 5 to 6 so we still iterate 5 times.  I
left the other as it was because it's a large number.

Fixes: b3c70c9ea6 ("ASoC: Alchemy AC97C/I2SC audio support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Dan Carpenter 2018-01-15 11:08:38 +03:00 committed by Mark Brown
parent 4fbd8d194f
commit 123af9043e
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 3 additions and 3 deletions

View File

@ -91,8 +91,8 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97,
do { do {
mutex_lock(&ctx->lock); mutex_lock(&ctx->lock);
tmo = 5; tmo = 6;
while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--) while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
udelay(21); /* wait an ac97 frame time */ udelay(21); /* wait an ac97 frame time */
if (!tmo) { if (!tmo) {
pr_debug("ac97rd timeout #1\n"); pr_debug("ac97rd timeout #1\n");
@ -105,7 +105,7 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97,
* poll, Forrest, poll... * poll, Forrest, poll...
*/ */
tmo = 0x10000; tmo = 0x10000;
while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--) while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
asm volatile ("nop"); asm volatile ("nop");
data = RD(ctx, AC97_CMDRESP); data = RD(ctx, AC97_CMDRESP);