ASoC: rt5514: Fix uninitialized calibration value
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 30 Jan 2018 13:19:43 +0000 (14:19 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 1 Mar 2018 19:31:50 +0000 (19:31 +0000)
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@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5514.c

index b358704ee19cb6b7b866d9a306bfdc2f34014982..e8a66b03faabf405ec43f7170e0205fd4650eb29 100644 (file)
@@ -357,6 +357,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
 #else
                                dev_err(component->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;