diff mbox series

[3/5] ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dapm_widget_elems_load()

Message ID 87pmuwwfl7.wl-kuninori.morimoto.gx@renesas.com
State Accepted
Commit e9aa139f95f5995d7010f46c285f5b9a19695b2d
Headers show
Series [1/5] ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_process_headers() | expand

Commit Message

Kuninori Morimoto Aug. 2, 2021, 6 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch cleanups below cppcheck warning.

sound/soc/soc-topology.c:1599:35: style: The scope of the variable 'widget' can be reduced. [variableScope]
 struct snd_soc_tplg_dapm_widget *widget;
                                  ^
sound/soc/soc-topology.c:1600:6: style: The scope of the variable 'ret' can be reduced. [variableScope]
 int ret, count, i;
     ^

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

Patch

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 359c6ac22153..98e08afd8eb9 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1583,15 +1583,16 @@  static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
 static int soc_tplg_dapm_widget_elems_load(struct soc_tplg *tplg,
 	struct snd_soc_tplg_hdr *hdr)
 {
-	struct snd_soc_tplg_dapm_widget *widget;
-	int ret, count, i;
+	int count, i;
 
 	count = le32_to_cpu(hdr->count);
 
 	dev_dbg(tplg->dev, "ASoC: adding %d DAPM widgets\n", count);
 
 	for (i = 0; i < count; i++) {
-		widget = (struct snd_soc_tplg_dapm_widget *) tplg->pos;
+		struct snd_soc_tplg_dapm_widget *widget = (struct snd_soc_tplg_dapm_widget *) tplg->pos;
+		int ret;
+
 		if (le32_to_cpu(widget->size) != sizeof(*widget)) {
 			dev_err(tplg->dev, "ASoC: invalid widget size\n");
 			return -EINVAL;