Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f3d25c0 authored by Fabio Estevam's avatar Fabio Estevam Committed by Mark Brown
Browse files

ASoC: wm8985: Refactor set_pll code to avoid gcc warnings



Refactor set_pll code to avoid the following warnings:

sound/soc/codecs/wm8985.c:852:50: warning: 'pll_div.k' may be used uninitialized in this function
sound/soc/codecs/wm8985.c:849:9: warning: 'pll_div.n' may be used uninitialized in this function
sound/soc/codecs/wm8985.c:848:23: warning: 'pll_div.div2' may be used uninitialized in this function

Do the same as in commit 86ce6c9a (ASoC: WM8804: Refactor set_pll code to avoid
GCC warnings).

Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent a49f0d1e
Loading
Loading
Loading
Loading
+20 −23
Original line number Original line Diff line number Diff line
@@ -830,18 +830,14 @@ static int wm8985_set_pll(struct snd_soc_dai *dai, int pll_id,
	struct pll_div pll_div;
	struct pll_div pll_div;


	codec = dai->codec;
	codec = dai->codec;
	if (freq_in && freq_out) {
	if (!freq_in || !freq_out) {
		/* disable the PLL */
		snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1,
				    WM8985_PLLEN_MASK, 0);
	} else {
		ret = pll_factors(&pll_div, freq_out * 4 * 2, freq_in);
		ret = pll_factors(&pll_div, freq_out * 4 * 2, freq_in);
		if (ret)
		if (ret)
			return ret;
			return ret;
	}

	/* disable the PLL before reprogramming it */
	snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1,
			    WM8985_PLLEN_MASK, 0);
	
	if (!freq_in || !freq_out)
		return 0;


		/* set PLLN and PRESCALE */
		/* set PLLN and PRESCALE */
		snd_soc_write(codec, WM8985_PLL_N,
		snd_soc_write(codec, WM8985_PLL_N,
@@ -857,6 +853,7 @@ static int wm8985_set_pll(struct snd_soc_dai *dai, int pll_id,
		/* enable the PLL */
		/* enable the PLL */
		snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1,
		snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1,
				    WM8985_PLLEN_MASK, WM8985_PLLEN);
				    WM8985_PLLEN_MASK, WM8985_PLLEN);
	}
	return 0;
	return 0;
}
}