From dbfb35abbe8548fe5e33763bcab5a5c04ade0d36 Mon Sep 17 00:00:00 2001 From: Mark Farrugia Date: Tue, 18 Dec 2018 17:16:08 +1100 Subject: 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 --- pcm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pcm.c') 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; -- cgit 1.2.3-korg