All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning
@ 2021-08-05  1:10 Kuninori Morimoto
  2021-08-05  1:10 ` [PATCH 01/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup() Kuninori Morimoto
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:10 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


Hi Mark

Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer
discussion. Thus I want to post more easy patch first, and reduce my
local patches.

These are cppcheck warning cleanup patches for soc-dapm.

Kuninori Morimoto (12):
  ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup()
  ASoC: soc-dapm: cleanup cppcheck warning at dapm_connect_mux()
  ASoC: soc-dapm: cleanup cppcheck warning at dapm_set_mixer_path_status()
  ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_pga()
  ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_dai_link()
  ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_check_event()
  ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_run()
  ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_del_route()
  ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_add_routes()
  ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_weak_routes()
  ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_new_controls()
  ASoC: soc-dapm: cleanup cppcheck warning at soc_dapm_dai_stream_event()

 sound/soc/soc-dapm.c | 65 ++++++++++++++++++++++----------------------
 1 file changed, 33 insertions(+), 32 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 01/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
@ 2021-08-05  1:10 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 02/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_connect_mux() Kuninori Morimoto
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:10 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:653:20: style: The scope of the variable 'wlist' can be reduced. [variableScope]
 struct list_head *wlist;
                   ^
sound/soc/soc-dapm.c:655:6: style: The scope of the variable 'i' can be reduced. [variableScope]
 int i = 0;
     ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 91bf939d5233..92193e9e1084 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -650,12 +650,11 @@ static struct snd_soc_dapm_widget *
 dapm_wcache_lookup(struct snd_soc_dapm_wcache *wcache, const char *name)
 {
 	struct snd_soc_dapm_widget *w = wcache->widget;
-	struct list_head *wlist;
-	const int depth = 2;
-	int i = 0;
 
 	if (w) {
-		wlist = &w->dapm->card->widgets;
+		struct list_head *wlist = &w->dapm->card->widgets;
+		const int depth = 2;
+		int i = 0;
 
 		list_for_each_entry_from(w, wlist, list) {
 			if (!strcmp(name, w->name))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_connect_mux()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
  2021-08-05  1:10 ` [PATCH 01/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 03/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_set_mixer_path_status() Kuninori Morimoto
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:751:15: style: The scope of the variable 'val' can be reduced. [variableScope]
 unsigned int val, item;
              ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 92193e9e1084..1c0457715008 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -747,10 +747,11 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm,
 {
 	const struct snd_kcontrol_new *kcontrol = &w->kcontrol_news[0];
 	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
-	unsigned int val, item;
+	unsigned int item;
 	int i;
 
 	if (e->reg != SND_SOC_NOPM) {
+		unsigned int val;
 		val = soc_dapm_read(dapm, e->reg);
 		val = (val >> e->shift_l) & e->mask;
 		item = snd_soc_enum_val_to_item(e, val);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_set_mixer_path_status()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
  2021-08-05  1:10 ` [PATCH 01/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup() Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 02/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_connect_mux() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 04/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_pga() Kuninori Morimoto
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning, and its related code.

sound/soc/soc-dapm.c:789:15: style: The scope of the variable 'val' can be reduced. [variableScope]
 unsigned int val;
              ^
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1c0457715008..0ccc59287513 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -782,14 +782,14 @@ static void dapm_set_mixer_path_status(struct snd_soc_dapm_path *p, int i,
 	struct soc_mixer_control *mc = (struct soc_mixer_control *)
 		p->sink->kcontrol_news[i].private_value;
 	unsigned int reg = mc->reg;
-	unsigned int shift = mc->shift;
-	unsigned int max = mc->max;
-	unsigned int mask = (1 << fls(max)) - 1;
 	unsigned int invert = mc->invert;
-	unsigned int val;
 
 	if (reg != SND_SOC_NOPM) {
-		val = soc_dapm_read(p->sink->dapm, reg);
+		unsigned int shift = mc->shift;
+		unsigned int max = mc->max;
+		unsigned int mask = (1 << fls(max)) - 1;
+		unsigned int val = soc_dapm_read(p->sink->dapm, reg);
+
 		/*
 		 * The nth_path argument allows this function to know
 		 * which path of a kcontrol it is setting the initial
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_pga()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 03/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_set_mixer_path_status() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 05/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_dai_link() Kuninori Morimoto
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:1063:9: style: The scope of the variable 'ret' can be reduced. [variableScope]
 int i, ret;
        ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 0ccc59287513..50f49a545596 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1060,10 +1060,10 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
 /* create new dapm volume control */
 static int dapm_new_pga(struct snd_soc_dapm_widget *w)
 {
-	int i, ret;
+	int i;
 
 	for (i = 0; i < w->num_kcontrols; i++) {
-		ret = dapm_create_or_share_kcontrol(w, i);
+		int ret = dapm_create_or_share_kcontrol(w, i);
 		if (ret < 0)
 			return ret;
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_dai_link()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 04/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_pga() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 06/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_check_event() Kuninori Morimoto
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning, and its related code.

sound/soc/soc-dapm.c:1077:9: style: The scope of the variable 'ret' can be reduced. [variableScope]
 int i, ret;
        ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 50f49a545596..cce6c9122397 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1074,10 +1074,7 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
 /* create new dapm dai link control */
 static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
 {
-	int i, ret;
-	struct snd_kcontrol *kcontrol;
-	struct snd_soc_dapm_context *dapm = w->dapm;
-	struct snd_card *card = dapm->card->snd_card;
+	int i;
 	struct snd_soc_pcm_runtime *rtd = w->priv;
 
 	/* create control for links with > 1 config */
@@ -1086,9 +1083,12 @@ static int dapm_new_dai_link(struct snd_soc_dapm_widget *w)
 
 	/* add kcontrol */
 	for (i = 0; i < w->num_kcontrols; i++) {
-		kcontrol = snd_soc_cnew(&w->kcontrol_news[i], w,
-					w->name, NULL);
-		ret = snd_ctl_add(card, kcontrol);
+		struct snd_soc_dapm_context *dapm = w->dapm;
+		struct snd_card *card = dapm->card->snd_card;
+		struct snd_kcontrol *kcontrol = snd_soc_cnew(&w->kcontrol_news[i],
+							     w, w->name, NULL);
+		int ret = snd_ctl_add(card, kcontrol);
+
 		if (ret < 0) {
 			dev_err(dapm->dev,
 				"ASoC: failed to add widget %s dapm kcontrol %s: %d\n",
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_check_event()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 05/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_dai_link() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 07/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_run() Kuninori Morimoto
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:1531:13: style: The scope of the variable 'ret' can be reduced. [variableScope]
 int power, ret;
            ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index cce6c9122397..7cb832ddf4af 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1528,7 +1528,7 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
 				 struct snd_soc_dapm_widget *w, int event)
 {
 	const char *ev_name;
-	int power, ret;
+	int power;
 
 	switch (event) {
 	case SND_SOC_DAPM_PRE_PMU:
@@ -1564,6 +1564,8 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
 		return;
 
 	if (w->event && (w->event_flags & event)) {
+		int ret;
+
 		pop_dbg(w->dapm->dev, card->pop_time, "pop test : %s %s\n",
 			w->name, ev_name);
 		soc_dapm_async_complete(w->dapm);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_run()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 06/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_check_event() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 08/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_del_route() Kuninori Morimoto
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:1648:6: style: The scope of the variable 'ret' can be reduced. [variableScope]
 int ret, i;
     ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7cb832ddf4af..bd3b443019fb 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1647,7 +1647,7 @@ static void dapm_seq_run(struct snd_soc_card *card,
 	int cur_subseq = -1;
 	int cur_reg = SND_SOC_NOPM;
 	struct snd_soc_dapm_context *cur_dapm = NULL;
-	int ret, i;
+	int i;
 	int *sort;
 
 	if (power_up)
@@ -1656,7 +1656,7 @@ static void dapm_seq_run(struct snd_soc_card *card,
 		sort = dapm_down_seq;
 
 	list_for_each_entry_safe(w, n, list, power_list) {
-		ret = 0;
+		int ret = 0;
 
 		/* Do we need to apply any queued changes? */
 		if (sort[w->id] != cur_sort || w->reg != cur_reg ||
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_del_route()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 07/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_run() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 09/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_add_routes() Kuninori Morimoto
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:3007:30: style: The scope of the variable 'wsource' can be reduced. [variableScope]
 struct snd_soc_dapm_widget *wsource, *wsink;
                             ^
sound/soc/soc-dapm.c:3007:40: style: The scope of the variable 'wsink' can be reduced. [variableScope]
 struct snd_soc_dapm_widget *wsource, *wsink;
                                       ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index bd3b443019fb..c7fb142f3462 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3006,7 +3006,6 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
 static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
 				  const struct snd_soc_dapm_route *route)
 {
-	struct snd_soc_dapm_widget *wsource, *wsink;
 	struct snd_soc_dapm_path *path, *p;
 	const char *sink;
 	const char *source;
@@ -3044,8 +3043,8 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
 	}
 
 	if (path) {
-		wsource = path->source;
-		wsink = path->sink;
+		struct snd_soc_dapm_widget *wsource = path->source;
+		struct snd_soc_dapm_widget *wsink = path->sink;
 
 		dapm_mark_dirty(wsource, "Route removed");
 		dapm_mark_dirty(wsink, "Route removed");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_add_routes()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 08/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_del_route() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 10/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_weak_routes() Kuninori Morimoto
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:3082:9: style: The scope of the variable 'r' can be reduced. [variableScope]
 int i, r, ret = 0;
        ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c7fb142f3462..9dd50b4899e3 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3080,11 +3080,11 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
 int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
 			    const struct snd_soc_dapm_route *route, int num)
 {
-	int i, r, ret = 0;
+	int i, ret = 0;
 
 	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
 	for (i = 0; i < num; i++) {
-		r = snd_soc_dapm_add_route(dapm, route);
+		int r = snd_soc_dapm_add_route(dapm, route);
 		if (r < 0) {
 			dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n",
 				route->source,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_weak_routes()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (8 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 09/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_add_routes() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 11/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_new_controls() Kuninori Morimoto
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:3190:9: style: The scope of the variable 'err' can be reduced. [variableScope]
 int i, err;
        ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 9dd50b4899e3..6e7fc8979f89 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3188,12 +3188,12 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm,
 int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm,
 			     const struct snd_soc_dapm_route *route, int num)
 {
-	int i, err;
+	int i;
 	int ret = 0;
 
 	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
 	for (i = 0; i < num; i++) {
-		err = snd_soc_dapm_weak_route(dapm, route);
+		int err = snd_soc_dapm_weak_route(dapm, route);
 		if (err)
 			ret = err;
 		route++;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 11/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_new_controls()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (9 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 10/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_weak_routes() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-05  1:11 ` [PATCH 12/12] ASoC: soc-dapm: cleanup cppcheck warning at soc_dapm_dai_stream_event() Kuninori Morimoto
  2021-08-06  0:47 ` [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Mark Brown
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:3786:30: style: The scope of the variable 'w' can be reduced. [variableScope]
 struct snd_soc_dapm_widget *w;
                             ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 6e7fc8979f89..7fc1659eead4 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3784,13 +3784,12 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
 	const struct snd_soc_dapm_widget *widget,
 	int num)
 {
-	struct snd_soc_dapm_widget *w;
 	int i;
 	int ret = 0;
 
 	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
 	for (i = 0; i < num; i++) {
-		w = snd_soc_dapm_new_control_unlocked(dapm, widget);
+		struct snd_soc_dapm_widget *w = snd_soc_dapm_new_control_unlocked(dapm, widget);
 		if (IS_ERR(w)) {
 			ret = PTR_ERR(w);
 			break;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 12/12] ASoC: soc-dapm: cleanup cppcheck warning at soc_dapm_dai_stream_event()
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (10 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 11/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_new_controls() Kuninori Morimoto
@ 2021-08-05  1:11 ` Kuninori Morimoto
  2021-08-06  0:47 ` [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Mark Brown
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  1:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-dapm.c:4368:15: style: The scope of the variable 'ep' can be reduced. [variableScope]
 unsigned int ep;
              ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-dapm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7fc1659eead4..7b67f1e19ae9 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -4365,11 +4365,12 @@ static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream,
 	int event)
 {
 	struct snd_soc_dapm_widget *w;
-	unsigned int ep;
 
 	w = snd_soc_dai_get_widget(dai, stream);
 
 	if (w) {
+		unsigned int ep;
+
 		dapm_mark_dirty(w, "stream event");
 
 		if (w->id == snd_soc_dapm_dai_in) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning
  2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
                   ` (11 preceding siblings ...)
  2021-08-05  1:11 ` [PATCH 12/12] ASoC: soc-dapm: cleanup cppcheck warning at soc_dapm_dai_stream_event() Kuninori Morimoto
@ 2021-08-06  0:47 ` Mark Brown
  12 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2021-08-06  0:47 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown

On 05 Aug 2021 10:10:35 +0900, Kuninori Morimoto wrote:
> Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer
> discussion. Thus I want to post more easy patch first, and reduce my
> local patches.
> 
> These are cppcheck warning cleanup patches for soc-dapm.
> 
> Kuninori Morimoto (12):
>   ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup()
>   ASoC: soc-dapm: cleanup cppcheck warning at dapm_connect_mux()
>   ASoC: soc-dapm: cleanup cppcheck warning at dapm_set_mixer_path_status()
>   ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_pga()
>   ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_dai_link()
>   ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_check_event()
>   ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_run()
>   ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_del_route()
>   ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_add_routes()
>   ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_weak_routes()
>   ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_new_controls()
>   ASoC: soc-dapm: cleanup cppcheck warning at soc_dapm_dai_stream_event()
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[01/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup()
        commit: 7453d6d45d5587d3d4d4fdaec746db74ac5f7429
[02/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_connect_mux()
        commit: af6b57ab7fdd88e1b251376ee92fd335abd2241e
[03/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_set_mixer_path_status()
        commit: 29155bba18182daf46e0c4c784a2344d44ef082a
[04/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_pga()
        commit: a16cfb1bee80e3a3f7cab59a58580258b6d1efcf
[05/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_dai_link()
        commit: 5c52e48fb1c2ae68b997d81a781ce0104dbbb91a
[06/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_check_event()
        commit: 65f7316d18f2b447931eef00c04253859bdbe142
[07/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_run()
        commit: a71657947d74fbc9e0184079f9e1941d70ccb52c
[08/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_del_route()
        commit: fd5ad2346148373890b4e7e7e0b1d7b208772a68
[09/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_add_routes()
        commit: fcb3f196f808f2d53d3a8f0a728ffd61f9d44e11
[10/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_weak_routes()
        commit: fd136fdbf4a66add171eb0cedf40f430bda9c139
[11/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_new_controls()
        commit: 3dc72e4251d7ccd90517433b84f133d4a18179c3
[12/12] ASoC: soc-dapm: cleanup cppcheck warning at soc_dapm_dai_stream_event()
        commit: f2ff5fbe343d08e880fb1d10dbbdc335a3ceca4b

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-08-06  0:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05  1:10 [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Kuninori Morimoto
2021-08-05  1:10 ` [PATCH 01/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 02/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_connect_mux() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 03/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_set_mixer_path_status() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 04/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_pga() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 05/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_dai_link() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 06/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_check_event() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 07/12] ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_run() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 08/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_del_route() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 09/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_add_routes() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 10/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_weak_routes() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 11/12] ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_new_controls() Kuninori Morimoto
2021-08-05  1:11 ` [PATCH 12/12] ASoC: soc-dapm: cleanup cppcheck warning at soc_dapm_dai_stream_event() Kuninori Morimoto
2021-08-06  0:47 ` [PATCH 00/12] ASoC: soc-dapm: cleanup cppcheck warning Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.