diff mbox series

[4/8] ASoC: sh: rcar: core: rename shadowing variables

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

Commit Message

Pierre-Louis Bossart Feb. 19, 2021, 11:16 p.m. UTC
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(-)

Comments

Kuninori Morimoto Feb. 21, 2021, 11:27 p.m. UTC | #1
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
Pierre-Louis Bossart Feb. 22, 2021, 3:41 p.m. UTC | #2
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
>
Kuninori Morimoto Feb. 24, 2021, 11:13 p.m. UTC | #3
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 mbox series

Patch

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++;
 		}