From 6f26cfd8c4c8463f4538e252401f1347d9922777 Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Tue, 15 Oct 2019 09:47:51 +0200 Subject: [PATCH] dai: verify if DMA channel exists in dai_prepare Checks if DMA channel exists in dai_prepare. This way we will avoid exception in case DAI config hasn't been called before. Signed-off-by: Tomasz Lauda --- src/audio/dai.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/audio/dai.c b/src/audio/dai.c index 2334c1414..9609ad6eb 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -441,6 +441,13 @@ static int dai_prepare(struct comp_dev *dev) dev->position = 0; + if (!dd->chan) { + trace_dai_error_with_ids(dev, "dai_prepare() error: Missing " + "dd->chan."); + comp_set_state(dev, COMP_TRIGGER_RESET); + return -EINVAL; + } + if (!dd->config.elem_array.elems) { trace_dai_error_with_ids(dev, "dai_prepare() error: Missing " "dd->config.elem_array.elems.");