summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-01-15 11:08:38 +0300
committerBen Hutchings <ben@decadent.org.uk>2018-06-16 22:21:53 +0100
commit744ac1c61844092b86c241fea6c0948648dba00b (patch)
treec4d0405a1233d5771144296a5d34e2f61e2fa2a4 /sound
parent92e516eb79788458bc1e2feebcc9c7998112e443 (diff)
downloadlinux-stable-744ac1c61844092b86c241fea6c0948648dba00b.tar.gz
linux-stable-744ac1c61844092b86c241fea6c0948648dba00b.tar.bz2
linux-stable-744ac1c61844092b86c241fea6c0948648dba00b.zip
ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
commit 123af9043e93cb6f235207d260d50f832cdb5439 upstream. 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: b3c70c9ea62a ("ASoC: Alchemy AC97C/I2SC audio support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/au1x/ac97c.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c
index c8a2de103c5f..7591e48662bf 100644
--- a/sound/soc/au1x/ac97c.c
+++ b/sound/soc/au1x/ac97c.c
@@ -91,8 +91,8 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97,
do {
mutex_lock(&ctx->lock);
- tmo = 5;
- while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--)
+ tmo = 6;
+ while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
udelay(21); /* wait an ac97 frame time */
if (!tmo) {
pr_debug("ac97rd timeout #1\n");
@@ -105,7 +105,7 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97,
* poll, Forrest, poll...
*/
tmo = 0x10000;
- while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--)
+ while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
asm volatile ("nop");
data = RD(ctx, AC97_CMDRESP);