From abe8a86eef4da8a9947565c0abeaa49107e0eb38 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Mon, 2 Jan 2023 12:22:59 +0200 Subject: [PATCH] dai-zephyr: handle dai_config_get() errors properly Add error check in dai_get_hw_params() for the case where dai_config_get() returns an error. Signed-off-by: Kai Vehmanen --- src/audio/dai-zephyr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/audio/dai-zephyr.c b/src/audio/dai-zephyr.c index 0a8d618a4e9e..d9830fd345dd 100644 --- a/src/audio/dai-zephyr.c +++ b/src/audio/dai-zephyr.c @@ -165,6 +165,9 @@ static int dai_get_hw_params(struct dai *dai, struct sof_ipc_stream_params *par { const struct dai_config *cfg = dai_config_get(dai->dev, dir); + if (!cfg) + return -EINVAL; + params->rate = cfg->rate; params->buffer_fmt = 0; params->channels = cfg->channels;