Commit 311742c4 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

ASoC: lpass-platform: initialize dma channel number

commit 3b89e4b7 upstream.

A bugfix accidentally removed the implicit initialization of the
dma channel number, causing undefined behavior when
v->alloc_dma_channel is NULL:

sound/soc/qcom/lpass-platform.c: In function ‘lpass_platform_pcmops_open’:
sound/soc/qcom/lpass-platform.c:83:29: error: ‘dma_ch’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

This adds back an explicit initialization to zero, restoring the
previous behavior for that case.

Fixes: 022d00ee ("ASoC: lpass-platform: Fix broken pcm data usage")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarKenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent afd7e2b4
...@@ -78,6 +78,9 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) ...@@ -78,6 +78,9 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
dma_ch = 0; dma_ch = 0;
if (v->alloc_dma_channel) if (v->alloc_dma_channel)
dma_ch = v->alloc_dma_channel(drvdata, dir); dma_ch = v->alloc_dma_channel(drvdata, dir);
else
dma_ch = 0;
if (dma_ch < 0) if (dma_ch < 0)
return dma_ch; return dma_ch;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment