Skip to content

Commit

Permalink
ASoC: Fix DMA channel leak in imx-pcm-dma-mx2 driver.
Browse files Browse the repository at this point in the history
"snd_imx_pcm_hw_params" callback can be called
several times by the user (i.e. OSS emulation)
leading to a DMA channel leak.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Javier Martin authored and Mark Brown committed Jan 12, 2012
1 parent 36ae1a9 commit 220d9f2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sound/soc/imx/imx-pcm-dma-mx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
iprtd->dma_data.dma_request = dma_params->dma;

/* Try to grab a DMA channel */
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
iprtd->dma_chan = dma_request_channel(mask, filter, iprtd);
if (!iprtd->dma_chan)
return -EINVAL;
if (!iprtd->dma_chan) {
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
iprtd->dma_chan = dma_request_channel(mask, filter, iprtd);
if (!iprtd->dma_chan)
return -EINVAL;
}

switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
Expand Down

0 comments on commit 220d9f2

Please sign in to comment.