Commit 00463c11 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 8691d074
...@@ -25,9 +25,10 @@ struct rsnd_adg { ...@@ -25,9 +25,10 @@ struct rsnd_adg {
}; };
#define for_each_rsnd_clk(pos, adg, i) \ #define for_each_rsnd_clk(pos, adg, i) \
for (i = 0, (pos) = adg->clk[i]; \ for (i = 0; \
i < CLKMAX; \ (i < CLKMAX) && \
i++, (pos) = adg->clk[i]) ((pos) = adg->clk[i]); \
i++)
#define rsnd_priv_to_adg(priv) ((struct rsnd_adg *)(priv)->adg) #define rsnd_priv_to_adg(priv) ((struct rsnd_adg *)(priv)->adg)
......
...@@ -216,9 +216,10 @@ struct rsnd_dai { ...@@ -216,9 +216,10 @@ struct rsnd_dai {
#define rsnd_dai_nr(priv) ((priv)->dai_nr) #define rsnd_dai_nr(priv) ((priv)->dai_nr)
#define for_each_rsnd_dai(rdai, priv, i) \ #define for_each_rsnd_dai(rdai, priv, i) \
for (i = 0, (rdai) = rsnd_dai_get(priv, i); \ for (i = 0; \
i < rsnd_dai_nr(priv); \ (i < rsnd_dai_nr(priv)) && \
i++, (rdai) = rsnd_dai_get(priv, i)) ((rdai) = rsnd_dai_get(priv, i)); \
i++)
struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id); struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id);
int rsnd_dai_disconnect(struct rsnd_mod *mod); int rsnd_dai_disconnect(struct rsnd_mod *mod);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment