From 450838ec65119149cff3cdfa97f5cecfa5173ee5 Mon Sep 17 00:00:00 2001 From: Mark Farrugia Date: Tue, 29 Jan 2019 18:46:58 +1100 Subject: Check if card is sealed before attempting to map a stream Signed-off-by: Mark Farrugia --- pcm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pcm.c b/pcm.c index a62d89a..e91b121 100644 --- a/pcm.c +++ b/pcm.c @@ -67,6 +67,11 @@ static int pcm_open(struct snd_pcm_substream *substream) struct snd_pcm_hardware *hw; unsigned int chans = 0; + if (!snd_avirt_streams_sealed()) { + D_ERRORK("Cannot open PCM. Card is not sealed"); + return -EPERM; + } + // Find the Audio Path mapped to this device stream = snd_avirt_stream_find_by_device(substream->pcm->device); if (IS_ERR_VALUE(stream) || !stream) -- cgit 1.2.3-korg