diff mbox series

[18/24] ASoC: rt5668: remove useless assignments

Message ID 20210302212527.55158-19-pierre-louis.bossart@linux.intel.com
State Accepted
Commit 6fa5445685150dee9930cdfe7a96353a4dcc1d50
Headers show
Series ASoC: realtek: fix cppcheck warnings | expand

Commit Message

Pierre-Louis Bossart March 2, 2021, 9:25 p.m. UTC
cppcheck warnings:

sound/soc/codecs/rt5668.c:1177:6: style: Redundant initialization for
'idx'. The initialized value is overwritten before it is
read. [redundantInitialization]
 idx = rt5668_div_sel(rt5668, 1500000, div, ARRAY_SIZE(div));
     ^
sound/soc/codecs/rt5668.c:1174:10: note: idx is initialized
 int idx = -EINVAL;
         ^
sound/soc/codecs/rt5668.c:1177:6: note: idx is overwritten
 idx = rt5668_div_sel(rt5668, 1500000, div, ARRAY_SIZE(div));
     ^

sound/soc/codecs/rt5668.c:1202:6: style: Redundant initialization for
'idx'. The initialized value is overwritten before it is
read. [redundantInitialization]
 idx = rt5668_div_sel(rt5668, ref, div, ARRAY_SIZE(div));
     ^
sound/soc/codecs/rt5668.c:1191:25: note: idx is initialized
 int ref, val, reg, idx = -EINVAL;
                        ^
sound/soc/codecs/rt5668.c:1202:6: note: idx is overwritten
 idx = rt5668_div_sel(rt5668, ref, div, ARRAY_SIZE(div));
     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/rt5668.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt5668.c b/sound/soc/codecs/rt5668.c
index d966d6d1bf64..6ab1a8bc3735 100644
--- a/sound/soc/codecs/rt5668.c
+++ b/sound/soc/codecs/rt5668.c
@@ -1171,7 +1171,7 @@  static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 	struct snd_soc_component *component =
 		snd_soc_dapm_to_component(w->dapm);
 	struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component);
-	int idx = -EINVAL;
+	int idx;
 	static const int div[] = {2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128};
 
 	idx = rt5668_div_sel(rt5668, 1500000, div, ARRAY_SIZE(div));
@@ -1188,7 +1188,7 @@  static int set_filter_clk(struct snd_soc_dapm_widget *w,
 	struct snd_soc_component *component =
 		snd_soc_dapm_to_component(w->dapm);
 	struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component);
-	int ref, val, reg, idx = -EINVAL;
+	int ref, val, reg, idx;
 	static const int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48};
 
 	val = snd_soc_component_read(component, RT5668_GPIO_CTRL_1) &