From b35d2932c843cff6f2133e32f2bf49b8845b6741 Mon Sep 17 00:00:00 2001 From: Janusz Jankowski Date: Wed, 16 Oct 2019 15:13:11 +0200 Subject: [PATCH] pipeline: check task init result In case of unsuccessful scheduler task init, the pipeline task init should also fail. Signed-off-by: Janusz Jankowski --- src/audio/pipeline.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index f5ba79685816..3fb9b9a6e58d 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -357,9 +357,14 @@ static struct task *pipeline_task_init(struct pipeline *p, uint32_t type, task = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*task)); - if (task) - schedule_task_init(task, type, p->ipc_pipe.priority, func, NULL, - p, p->ipc_pipe.core, 0); + if (!task) + return NULL; + + if (schedule_task_init(task, type, p->ipc_pipe.priority, func, + NULL, p, p->ipc_pipe.core, 0) < 0) { + rfree(task); + task = NULL; + } return task; }