* [PATCH 1/2] ASoC: rt5514: Fix rt5514_spi_burst_read() buffer passing
@ 2018-01-30 13:19 Geert Uytterhoeven
2018-01-30 13:19 ` [PATCH 2/2] ASoC: rt5514: Fix uninitialized calibration value Geert Uytterhoeven
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2018-01-30 13:19 UTC (permalink / raw)
To: Bard Liao, Oder Chiou, Jaroslav Kysela, Takashi Iwai
Cc: alsa-devel, Arnd Bergmann, Liam Girdwood, linux-kernel,
Mark Brown, Geert Uytterhoeven
rt5514_dsp_voice_wake_up_put() passes "(u8 *)&buf" to
rt5514_spi_burst_read(), where the cast is needed to silence a compiler
warning:
sound/soc/codecs/rt5514.c: In function ‘rt5514_dsp_voice_wake_up_put’:
sound/soc/codecs/rt5514.c:357: warning: passing argument 2 of ‘rt5514_spi_burst_read’ from incompatible pointer type
However, as the variable is declared as an array ("u8 buf[8]"), the
function should just pass "buf" instead.
Fixes: fc9cab05837639ce ("ASoC: rt5514: The DSP clock can be calibrated by the other clock source")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
sound/soc/codecs/rt5514.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c
index 198df016802f826d..19f01558fbca677f 100644
--- a/sound/soc/codecs/rt5514.c
+++ b/sound/soc/codecs/rt5514.c
@@ -354,8 +354,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
msleep(20);
#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
rt5514_spi_burst_read(RT5514_PLL3_CALIB_CTRL6 |
- RT5514_DSP_MAPPING,
- (u8 *)&buf, sizeof(buf));
+ RT5514_DSP_MAPPING, buf, sizeof(buf));
#else
dev_err(codec->dev, "There is no SPI driver for"
" loading the firmware\n");
--
2.7.4
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] ASoC: rt5514: Fix uninitialized calibration value
2018-01-30 13:19 [PATCH 1/2] ASoC: rt5514: Fix rt5514_spi_burst_read() buffer passing Geert Uytterhoeven
@ 2018-01-30 13:19 ` Geert Uytterhoeven
0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2018-01-30 13:19 UTC (permalink / raw)
To: Bard Liao, Oder Chiou, Jaroslav Kysela, Takashi Iwai
Cc: alsa-devel, Arnd Bergmann, Liam Girdwood, linux-kernel,
Mark Brown, Geert Uytterhoeven
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>
---
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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-30 13:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-30 13:19 [PATCH 1/2] ASoC: rt5514: Fix rt5514_spi_burst_read() buffer passing Geert Uytterhoeven
2018-01-30 13:19 ` [PATCH 2/2] ASoC: rt5514: Fix uninitialized calibration value Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).