]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ASoC: codec: wm9860: avoid maybe-uninitialized warning
authorDaniel Baluta <daniel.baluta@nxp.com>
Wed, 26 Apr 2017 13:09:51 +0000 (16:09 +0300)
committerMark Brown <broonie@kernel.org>
Sun, 30 Apr 2017 13:14:27 +0000 (22:14 +0900)
commit66772eda0edbfbbbe7767a6b5d07e09dae84403d
tree52f10d0c2ddecb38a7040ab5b219537693e88767
parent303e8954af8daa087e4f42788672d280337071ab
ASoC: codec: wm9860: avoid maybe-uninitialized warning

The new PLL configuration code triggers a harmless warning:

sound/soc/codecs/wm8960.c: In function 'wm8960_configure_clocking':
sound/soc/codecs/wm8960.c:735:3: error: 'best_freq_out' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
   wm8960_set_pll(codec, freq_in, best_freq_out);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/wm8960.c:699:12: note: 'best_freq_out' was declared
here

Fix this by reworking the code such that:

1) When there is no PLL freq available return -EINVAL and make
sure *bclk_idx, *dac_idx, *sysclk_idx are initialized with
invalid values.

2) When there is a PLL freq available initialize *bclk_idx,
*dac_idx and *sysclk_idx with correct values and immediately
return the freq available.

Fixes: 84fdc00d519f ("ASoC: codec: wm9860: Refactor PLL out freq search")
Fixes: 303e8954af8d ("ASoC: codec: wm8960: Stop when a matching PLL freq is found")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wm8960.c