From: Russell King Date: Wed, 12 Jan 2011 23:17:24 +0000 (+0000) Subject: ALSA: AACI: fix timeout condition checking X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=69058cd6d10423126ab6aeb568f4af2bd34c49fe;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ALSA: AACI: fix timeout condition checking Ensure that a timeout coincident with the condition being waited for results in success rather than failure. This helps avoid timeout conditions being inappropriately flagged. Signed-off-by: Russell King --- diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 91acc9a243ec..21ff6296d160 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c @@ -88,7 +88,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, v = readl(aaci->base + AACI_SLFR); } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout); - if (!timeout) + if (v & (SLFR_1TXB|SLFR_2TXB)) dev_err(&aaci->dev->dev, "timeout waiting for write to complete\n"); @@ -124,7 +124,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) v = readl(aaci->base + AACI_SLFR); } while ((v & SLFR_1TXB) && --timeout); - if (!timeout) { + if (v & SLFR_1TXB) { dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n"); v = ~0; goto out; @@ -145,7 +145,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout); - if (!timeout) { + if (v != (SLFR_1RXV|SLFR_2RXV)) { dev_err(&aaci->dev->dev, "timeout on RX valid\n"); v = ~0; goto out;