[alsa-devel] [PATCH] ASoC: rsnd: fixup for_each_rsnd_mod_array{s} iterator increment

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Fri Jan 20 05:23:29 CET 2017


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 at jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
Mark

This is bugfix for v4.10. 
Can you please apply this patch to it?

 sound/soc/sh/rcar/core.c | 2 --
 sound/soc/sh/rcar/rsnd.h | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 99b5b08..47b370c 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -363,8 +363,6 @@ struct rsnd_mod *rsnd_mod_next(int *iterator,
 		if (!mod)
 			continue;
 
-		(*iterator)++;
-
 		return mod;
 	}
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index b90df77..7410ec0 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -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))
 
-- 
1.9.1



More information about the Alsa-devel mailing list