mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 12:30:55 +07:00
ASoC: Fix missing spin_unlock_irqrestore
In nuc900_dma_hw_params(), if snd_pcm_lib_malloc_pages failed it returns without calling spin_unlock_irqrestore(). Since snd_pcm_lib_malloc_pages() does not touch struct nuc900_audio, we don't need to hold the lock while calling snd_pcm_lib_malloc_pages(). Fix it by moving spin_lock_irqsave() down to after snd_pcm_lib_malloc_pages(). In nuc900_dma_prepare(), spin_unlock_irqrestore() is missing in the error path. Fix it by removing the return in default case. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Wan ZongShun <mcuos.com@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
39a545559f
commit
3f1af9d26f
@ -50,12 +50,12 @@ static int nuc900_dma_hw_params(struct snd_pcm_substream *substream,
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
spin_lock_irqsave(&nuc900_audio->lock, flags);
|
||||
|
||||
ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&nuc900_audio->lock, flags);
|
||||
|
||||
nuc900_audio->substream = substream;
|
||||
nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr;
|
||||
nuc900_audio->buffersize[substream->stream] =
|
||||
@ -169,6 +169,7 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct nuc900_audio *nuc900_audio = runtime->private_data;
|
||||
unsigned long flags, val;
|
||||
int ret = 0;
|
||||
|
||||
spin_lock_irqsave(&nuc900_audio->lock, flags);
|
||||
|
||||
@ -197,10 +198,10 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
|
||||
AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
}
|
||||
spin_unlock_irqrestore(&nuc900_audio->lock, flags);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int nuc900_dma_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
|
Loading…
Reference in New Issue
Block a user