From 65464a15c5fd3dc42932d9fe774b2e91bf739ba4 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 11 Dec 2023 12:17:06 +0200 Subject: [PATCH] Audio: Module adapter: Fix return value when no prepare operation The build of testbench for MTL platform simulation causes this build fail (rebuilt-testbench -p mtl): src/audio/module_adapter/module/generic.c:213:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (md->ops->prepare) { ^~~~~~~~~~~~~~~~ src/audio/module_adapter/module/generic.c:236:9: note: uninitialized use occurs here return ret; ^~~ Since it's a possibility to have a module without prepare() operation, the initialize to zero is added to avoid the return of undefined value. Reported-by: Marc Herbert Signed-off-by: shastry Signed-off-by: Seppo Ingalsuo --- src/audio/module_adapter/module/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/module_adapter/module/generic.c b/src/audio/module_adapter/module/generic.c index 3ab9f991feb9..9455021aee6c 100644 --- a/src/audio/module_adapter/module/generic.c +++ b/src/audio/module_adapter/module/generic.c @@ -198,7 +198,7 @@ int module_prepare(struct processing_module *mod, struct sof_source **sources, int num_of_sources, struct sof_sink **sinks, int num_of_sinks) { - int ret; + int ret = 0; struct module_data *md = &mod->priv; struct comp_dev *dev = mod->dev;