[PATCH 2/2] ASoC: rt5514: Fix uninitialized calibration value
From: Geert Uytterhoeven
Date: Tue Jan 30 2018 - 08:19:57 EST
With gcc-4.1.2, if CONFIG_SND_SOC_RT5514_SPI is not set:
sound/soc/codecs/rt5514.c: In function ârt5514_dsp_voice_wake_up_putâ:
sound/soc/codecs/rt5514.c:363: warning: âbuf[0]â is used uninitialized in this function
sound/soc/codecs/rt5514.c:363: warning: âbuf[1]â is used uninitialized in this function
sound/soc/codecs/rt5514.c:363: warning: âbuf[2]â is used uninitialized in this function
sound/soc/codecs/rt5514.c:363: warning: âbuf[3]â is used uninitialized in this function
Fix this by initializing the buffer with zeroes, to avoid random bits
being written to the calibration register later.
Fixes: fc9cab05837639ce ("ASoC: rt5514: The DSP clock can be calibrated by the other clock source")
Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
sound/soc/codecs/rt5514.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c
index 19f01558fbca677f..e5fd0114b1fd4d85 100644
--- a/sound/soc/codecs/rt5514.c
+++ b/sound/soc/codecs/rt5514.c
@@ -358,6 +358,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
#else
dev_err(codec->dev, "There is no SPI driver for"
" loading the firmware\n");
+ memset(buf, 0, sizeof(buf));
#endif
rt5514->pll3_cal_value = buf[0] | buf[1] << 8 |
buf[2] << 16 | buf[3] << 24;
--
2.7.4