diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-02-11 20:15:51 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-02-12 06:59:35 -0500 |
commit | 00463c113b6ba6506b4f1ebb9b3c5dd249f8750f (patch) | |
tree | 194039a26733d752b630cea531bc7fc1563cb545 /sound/soc/sh/rcar | |
parent | 8691d0748e566f8708f7a9139e760134f5dc3130 (diff) |
ASoC: rsnd: tidyup original for_each_rsnd_xxx macro
Current for_each_rsnd_xxx macro will read out-of-array's
memory after last loop operation.
It was not good C language operation, and the binary which was
compiled by (at least) gcc 4.8.1 is broken
This patch tidyup these issues
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/sh/rcar')
-rw-r--r-- | sound/soc/sh/rcar/adg.c | 7 | ||||
-rw-r--r-- | sound/soc/sh/rcar/rsnd.h | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c index 8d3a82ef2db5..bc8961c5e986 100644 --- a/sound/soc/sh/rcar/adg.c +++ b/sound/soc/sh/rcar/adg.c | |||
@@ -25,9 +25,10 @@ struct rsnd_adg { | |||
25 | }; | 25 | }; |
26 | 26 | ||
27 | #define for_each_rsnd_clk(pos, adg, i) \ | 27 | #define for_each_rsnd_clk(pos, adg, i) \ |
28 | for (i = 0, (pos) = adg->clk[i]; \ | 28 | for (i = 0; \ |
29 | i < CLKMAX; \ | 29 | (i < CLKMAX) && \ |
30 | i++, (pos) = adg->clk[i]) | 30 | ((pos) = adg->clk[i]); \ |
31 | i++) | ||
31 | #define rsnd_priv_to_adg(priv) ((struct rsnd_adg *)(priv)->adg) | 32 | #define rsnd_priv_to_adg(priv) ((struct rsnd_adg *)(priv)->adg) |
32 | 33 | ||
33 | 34 | ||
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 8b66dc15fa73..9e4efb40416b 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h | |||
@@ -216,9 +216,10 @@ struct rsnd_dai { | |||
216 | 216 | ||
217 | #define rsnd_dai_nr(priv) ((priv)->dai_nr) | 217 | #define rsnd_dai_nr(priv) ((priv)->dai_nr) |
218 | #define for_each_rsnd_dai(rdai, priv, i) \ | 218 | #define for_each_rsnd_dai(rdai, priv, i) \ |
219 | for (i = 0, (rdai) = rsnd_dai_get(priv, i); \ | 219 | for (i = 0; \ |
220 | i < rsnd_dai_nr(priv); \ | 220 | (i < rsnd_dai_nr(priv)) && \ |
221 | i++, (rdai) = rsnd_dai_get(priv, i)) | 221 | ((rdai) = rsnd_dai_get(priv, i)); \ |
222 | i++) | ||
222 | 223 | ||
223 | struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id); | 224 | struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id); |
224 | int rsnd_dai_disconnect(struct rsnd_mod *mod); | 225 | int rsnd_dai_disconnect(struct rsnd_mod *mod); |