ASoC: nuc900: Fix a loop timeout test [Linux 3.18.101]

This Linux kernel change "ASoC: nuc900: Fix a loop timeout test" is included in the Linux 3.18.101 release. This change is authored by Dan Carpenter <dan.carpenter [at]> on Sat Dec 9 14:52:28 2017 +0300. The commit for this change in Linux stable tree is 7adccfc (patch) which is from upstream commit 65a12b3. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 65a12b3.

ASoC: nuc900: Fix a loop timeout test

[ Upstream commit 65a12b3aafed5fc59f4ce41b22b752b1729e6701 ]

We should be finishing the loop with timeout set to zero but because
this is a post-op we finish with timeout == -1.

Fixes: 1082e2703a2d ("ASoC: NUC900/audio: add nuc900 audio driver support")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 sound/soc/nuc900/nuc900-ac97.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c
index f2f67942..84a4fc8 100644
--- a/sound/soc/nuc900/nuc900-ac97.c
+++ b/sound/soc/nuc900/nuc900-ac97.c
@@ -67,7 +67,7 @@ static unsigned short nuc900_ac97_read(struct snd_ac97 *ac97,

    /* polling the AC_R_FINISH */
    while (!(AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_R_FINISH)
-                               && timeout--)
+                               && --timeout)

    if (!timeout) {
@@ -121,7 +121,7 @@ static void nuc900_ac97_write(struct snd_ac97 *ac97, unsigned short reg,

    /* polling the AC_W_FINISH */
    while ((AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_W_FINISH)
-                               && timeout--)
+                               && --timeout)

    if (!timeout)

Leave a Reply

Your email address will not be published. Required fields are marked *