summaryrefslogtreecommitdiffstats
path: root/pcm.c
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-12-18 17:16:08 +1100
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-12-18 17:16:36 +1100
commitdbfb35abbe8548fe5e33763bcab5a5c04ade0d36 (patch)
tree63228886fa2a820af9d08bc2f6b566c89c22f605 /pcm.c
parent4737bc9ffcdd0ec17c8fa7629c15de6d4b30594d (diff)
Add check for channel count in pcm_open
We need to ensure that this is not set to 0, otherwise audio will not work properly. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
Diffstat (limited to 'pcm.c')
-rw-r--r--pcm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pcm.c b/pcm.c
index ff1b5fc..a62d89a 100644
--- a/pcm.c
+++ b/pcm.c
@@ -84,6 +84,10 @@ static int pcm_open(struct snd_pcm_substream *substream)
// Setup remaining hw properties
chans = stream->channels;
+ if (chans == 0) {
+ D_ERRORK("Channels cannot be 0");
+ return -EINVAL;
+ }
hw->channels_min = chans;
hw->channels_max = chans;