ASoC: samsung: dma: Fix the memory resource leakage issue 41/30141/2
authorHuang Chao <chao7.huang@samsung.com>
Wed, 12 Nov 2014 03:44:32 +0000 (11:44 +0800)
committerSylwester Nawrocki <s.nawrocki@samsung.com>
Thu, 27 Nov 2014 13:39:48 +0000 (05:39 -0800)
After we use kzalloc to allocate memory and make chan point
to this block resource, then dma_request_slave_channel will
overwrite the pointer chan, which can result to memory leak
where chan points to.

Change-Id: Ie659df4e1855abc3f57ac3c54e97a6a448dac26e
Signed-off-by: Huang Chao <chao7.huang@samsung.com>
sound/soc/samsung/dma.c

index fa31d17..b418b6f 100644 (file)
@@ -114,10 +114,6 @@ static int dma_open(struct snd_pcm_substream *substream)
 
        snd_soc_set_runtime_hwparams(substream, &dma_hardware);
 
-       chan = kzalloc(sizeof(struct dma_chan), GFP_KERNEL);
-       if (!chan)
-               return -ENOMEM;
-
        /* Request slave dma channel according to playback/capture stream */
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
                chan = dma_request_slave_channel(rtd->cpu_dai->dev,