Message ID | 20210219231635.5749-5-pierre-louis.bossart@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ASoC: sh: remove cppcheck warnings | expand |
Hi Pierre-Louis > sound/soc/sh/rcar/core.c:1369:22: style: Local variable 'rdai' shadows > outer variable [shadowVariable] > struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); > ^ I'm not 100% sure about this warning, but this path is overkill. Maybe below is enough ? --------- diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 8533aa696183..cae9639c0ef9 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1382,7 +1382,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_endpoint_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) { - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); + rdai = rsnd_rdai_get(priv, dai_i); rsnd_parse_connect_graph(priv, &rdai->playback, dai_np); rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); @@ -1393,7 +1393,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_child_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) { - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); + rdai = rsnd_rdai_get(priv, dai_i); rsnd_parse_connect_simple(priv, &rdai->playback, dai_np); rsnd_parse_connect_simple(priv, &rdai->capture, dai_np); ---- Thank you for your help !! Best regards --- Kuninori Morimoto
On 2/21/21 5:27 PM, Kuninori Morimoto wrote: > > Hi Pierre-Louis > >> sound/soc/sh/rcar/core.c:1369:22: style: Local variable 'rdai' shadows >> outer variable [shadowVariable] >> struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); >> ^ > > I'm not 100% sure about this warning, > but this path is overkill. Maybe below is enough ? Hi Morimoto-san, It might be better if we drop this patch from the series and have you send the proper fix with my Reported-by tag. Would that work for you? Thanks! > --------- > diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c > index 8533aa696183..cae9639c0ef9 100644 > --- a/sound/soc/sh/rcar/core.c > +++ b/sound/soc/sh/rcar/core.c > @@ -1382,7 +1382,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) > for_each_endpoint_of_node(dai_node, dai_np) { > __rsnd_dai_probe(priv, dai_np, dai_i); > if (rsnd_is_gen3(priv)) { > - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); > + rdai = rsnd_rdai_get(priv, dai_i); > > rsnd_parse_connect_graph(priv, &rdai->playback, dai_np); > rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); > @@ -1393,7 +1393,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) > for_each_child_of_node(dai_node, dai_np) { > __rsnd_dai_probe(priv, dai_np, dai_i); > if (rsnd_is_gen3(priv)) { > - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); > + rdai = rsnd_rdai_get(priv, dai_i); > > rsnd_parse_connect_simple(priv, &rdai->playback, dai_np); > rsnd_parse_connect_simple(priv, &rdai->capture, dai_np); > ---- > > Thank you for your help !! > > Best regards > --- > Kuninori Morimoto >
Hi Pierre-Louis > >> sound/soc/sh/rcar/core.c:1369:22: style: Local variable 'rdai' shadows > >> outer variable [shadowVariable] > >> struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); > >> ^ > > > > I'm not 100% sure about this warning, > > but this path is overkill. Maybe below is enough ? > > Hi Morimoto-san, > It might be better if we drop this patch from the series and have you > send the proper fix with my Reported-by tag. > Would that work for you? OK, thanks. Will do today Thank you for your help !! Best regards --- Kuninori Morimoto
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index b1a75509851a..817eea79e0d2 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1366,10 +1366,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_endpoint_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) { - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); + struct rsnd_dai *dai = rsnd_rdai_get(priv, dai_i); - rsnd_parse_connect_graph(priv, &rdai->playback, dai_np); - rsnd_parse_connect_graph(priv, &rdai->capture, dai_np); + rsnd_parse_connect_graph(priv, &dai->playback, dai_np); + rsnd_parse_connect_graph(priv, &dai->capture, dai_np); } dai_i++; } @@ -1377,10 +1377,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) for_each_child_of_node(dai_node, dai_np) { __rsnd_dai_probe(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) { - struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); + struct rsnd_dai *dai = rsnd_rdai_get(priv, dai_i); - rsnd_parse_connect_simple(priv, &rdai->playback, dai_np); - rsnd_parse_connect_simple(priv, &rdai->capture, dai_np); + rsnd_parse_connect_simple(priv, &dai->playback, dai_np); + rsnd_parse_connect_simple(priv, &dai->capture, dai_np); } dai_i++; }
cppcheck warnings: sound/soc/sh/rcar/core.c:1369:22: style: Local variable 'rdai' shadows outer variable [shadowVariable] struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); ^ sound/soc/sh/rcar/core.c:1338:19: note: Shadowed declaration struct rsnd_dai *rdai; ^ sound/soc/sh/rcar/core.c:1369:22: note: Shadow variable struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); ^ sound/soc/sh/rcar/core.c:1380:22: style: Local variable 'rdai' shadows outer variable [shadowVariable] struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); ^ sound/soc/sh/rcar/core.c:1338:19: note: Shadowed declaration struct rsnd_dai *rdai; ^ sound/soc/sh/rcar/core.c:1380:22: note: Shadow variable struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); use a different name at lower scope. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> --- sound/soc/sh/rcar/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)