ASoC: rsnd: fixup for_each_rsnd_mod_array{s} iterator increment
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 20 Jan 2017 04:23:29 +0000 (04:23 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 23 Jan 2017 15:11:42 +0000 (15:11 +0000)
commit 5f222a292 ("ASoC: rsnd: use for_each_rsnd_mod_xxx() ...")
modifies rsnd_dai_call() to use for_each_rsnd_mod_arrays().

Current rsnd is incrementing iterator in rsnd_mod_next(),
but the iterator will indicate +1 position in for_each loop in
this case. Incremental position should be inside for()

Reported-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sh/rcar/core.c
sound/soc/sh/rcar/rsnd.h

index 4bd68de761309b57285bf203aa2ee46cabc440cc..948c5ec879805b656818f37b49bd4327d134f87d 100644 (file)
@@ -363,8 +363,6 @@ struct rsnd_mod *rsnd_mod_next(int *iterator,
                if (!mod)
                        continue;
 
-               (*iterator)++;
-
                return mod;
        }
 
index b90df77662dfa337e5ff50bb44ef59efa1eef6e6..7410ec0174db7db8c172c60c62f20f91c247df8d 100644 (file)
@@ -374,10 +374,10 @@ struct rsnd_mod *rsnd_mod_next(int *iterator,
                               int array_size);
 #define for_each_rsnd_mod(iterator, pos, io)                           \
        for (iterator = 0;                                              \
-            (pos = rsnd_mod_next(&iterator, io, NULL, 0));)
+            (pos = rsnd_mod_next(&iterator, io, NULL, 0)); iterator++)
 #define for_each_rsnd_mod_arrays(iterator, pos, io, array, size)       \
        for (iterator = 0;                                              \
-            (pos = rsnd_mod_next(&iterator, io, array, size));)
+            (pos = rsnd_mod_next(&iterator, io, array, size)); iterator++)
 #define for_each_rsnd_mod_array(iterator, pos, io, array)              \
        for_each_rsnd_mod_arrays(iterator, pos, io, array, ARRAY_SIZE(array))