Unverified Commit ec6aa9b5 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown
Browse files

ASoC: rt5682: remove useless assignments



cppcheck warnings:

sound/soc/codecs/rt5682.c:1234:6: style: Redundant initialization for
'idx'. The initialized value is overwritten before it is
read. [redundantInitialization]
 idx = rt5682_div_sel(rt5682, dmic_clk_rate, div, ARRAY_SIZE(div));
     ^
sound/soc/codecs/rt5682.c:1228:10: note: idx is initialized
 int idx = -EINVAL, dmic_clk_rate = 3072000;
         ^
sound/soc/codecs/rt5682.c:1234:6: note: idx is overwritten
 idx = rt5682_div_sel(rt5682, dmic_clk_rate, div, ARRAY_SIZE(div));
     ^

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

Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210302212527.55158-24-pierre-louis.bossart@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent e699b2c8
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1225,7 +1225,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
	struct snd_soc_component *component =
	struct snd_soc_component *component =
		snd_soc_dapm_to_component(w->dapm);
		snd_soc_dapm_to_component(w->dapm);
	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
	int idx = -EINVAL, dmic_clk_rate = 3072000;
	int idx, dmic_clk_rate = 3072000;
	static const int div[] = {2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128};
	static const int div[] = {2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128};


	if (rt5682->pdata.dmic_clk_rate)
	if (rt5682->pdata.dmic_clk_rate)
@@ -1245,7 +1245,7 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w,
	struct snd_soc_component *component =
	struct snd_soc_component *component =
		snd_soc_dapm_to_component(w->dapm);
		snd_soc_dapm_to_component(w->dapm);
	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
	int ref, val, reg, idx = -EINVAL;
	int ref, val, reg, idx;
	static const int div_f[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48};
	static const int div_f[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48};
	static const int div_o[] = {1, 2, 4, 6, 8, 12, 16, 24, 32, 48};
	static const int div_o[] = {1, 2, 4, 6, 8, 12, 16, 24, 32, 48};