[PATCH 5/7] ASoC: soc-core: cleanup cppcheck warning at snd_soc_add_controls()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Thu Jul 29 03:15:52 CEST 2021


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

This patch cleanups below cppcheck warning.

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

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

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e8fc6e06efdb..34182e530877 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2237,13 +2237,12 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
 	const struct snd_kcontrol_new *controls, int num_controls,
 	const char *prefix, void *data)
 {
-	int err, i;
+	int i;
 
 	for (i = 0; i < num_controls; i++) {
 		const struct snd_kcontrol_new *control = &controls[i];
-
-		err = snd_ctl_add(card, snd_soc_cnew(control, data,
-						     control->name, prefix));
+		int err = snd_ctl_add(card, snd_soc_cnew(control, data,
+							 control->name, prefix));
 		if (err < 0) {
 			dev_err(dev, "ASoC: Failed to add %s: %d\n",
 				control->name, err);
-- 
2.25.1



More information about the Alsa-devel mailing list