diff mbox

ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()

Message ID 20180115080838.q6nupi7rs7k5pdky@mwanda (mailing list archive)
State Accepted
Commit 123af9043e93cb6f235207d260d50f832cdb5439
Headers show

Commit Message

Dan Carpenter Jan. 15, 2018, 8:08 a.m. UTC
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>

Comments

Manuel Lauss Jan. 15, 2018, 8:25 a.m. UTC | #1
On Mon, Jan 15, 2018 at 9:08 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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>

Ackey-by: Manuel Lauss <manuel.lauss@gmail.com>

I didn't notice any failures with latest -git though, I've never
actually hit these
timeouts, even under maximum CPU load.

Manuel
Dan Carpenter Jan. 15, 2018, 8:37 a.m. UTC | #2
On Mon, Jan 15, 2018 at 09:25:15AM +0100, Manuel Lauss wrote:
> On Mon, Jan 15, 2018 at 9:08 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > 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>
> 
> Ackey-by: Manuel Lauss <manuel.lauss@gmail.com>
> 
> I didn't notice any failures with latest -git though, I've never
> actually hit these
> timeouts, even under maximum CPU load.
> 

Yeah.  These are static checker fixes, not something I hit in real life.

regards,
dan carpenter
diff mbox

Patch

diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c
index 29a97d52e8ad..66d6c52e7761 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);