]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: lpass-platform: initialize dma channel number
authorArnd Bergmann <arnd@arndb.de>
Tue, 8 Nov 2016 13:38:52 +0000 (14:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:39:28 +0000 (11:39 +0100)
commit 3b89e4b77ef9c2f985964fab17032db98f074ed0 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: 022d00ee0b55 ("ASoC: lpass-platform: Fix broken pcm data usage")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/qcom/lpass-platform.c

index b392e51de94d173a20b130ad663b6af7c1e25f19..420d200f9a0533bd335224784c2e7933a0c8c3b1 100644 (file)
@@ -78,6 +78,9 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
        dma_ch = 0;
        if (v->alloc_dma_channel)
                dma_ch = v->alloc_dma_channel(drvdata, dir);
+       else
+               dma_ch = 0;
+
        if (dma_ch < 0)
                return dma_ch;