Testbench: Fix segfault in pipeline_new() in topology parsing

This patch fixes the crash by adding initialize of sof->pipeline_posn
into pipeline initialization code.

Also the in load_pipeline() function the pipeline is initialized
to zeros to prevent random values to be passed in not set
struct fields. It didn't fix anything but makes debugging of crash
easier.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2020-03-25 16:02:55 +02:00 committed by Janusz Jankowski
parent 4bbdef7c16
commit 8320376ab4
2 changed files with 3 additions and 1 deletions

View File

@ -30,6 +30,8 @@ int tb_pipeline_setup(struct sof *sof)
/* init components */
sys_comp_init(sof);
/* other necessary initializations, todo: follow better SOF init */
pipeline_posn_init(sof);
init_system_notify(sof);
/* init IPC */

View File

@ -445,7 +445,7 @@ int load_pipeline(void *dev, int comp_id, int pipeline_id,
struct snd_soc_tplg_dapm_widget *widget, int sched_id)
{
struct sof *sof = (struct sof *)dev;
struct sof_ipc_pipe_new pipeline;
struct sof_ipc_pipe_new pipeline = {0};
int size = widget->priv.size;
int ret;