summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJavier Martin <javier.martin@vista-silicon.com>2012-01-12 12:30:38 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-12 12:04:40 -0800
commit220d9f259536e22afef30347b7b42148640282a7 (patch)
tree909c5e06893386769e983e5612e219f4aaa56a56 /sound
parent36ae1a96c4dcb0f6581d595cc5d43cf3a7e648c7 (diff)
downloadop-kernel-dev-220d9f259536e22afef30347b7b42148640282a7.zip
op-kernel-dev-220d9f259536e22afef30347b7b42148640282a7.tar.gz
ASoC: Fix DMA channel leak in imx-pcm-dma-mx2 driver.
"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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/imx/imx-pcm-dma-mx2.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c
index 1cf2fe8..7d7fbb5 100644
--- a/sound/soc/imx/imx-pcm-dma-mx2.c
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -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:
OpenPOWER on IntegriCloud