copier: fix a potentially uninitialised warning

The create_dai() function can return an uninitialised value. Fix it
by reducing the scope of the variable.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2022-12-20 08:02:48 +01:00 committed by Kai Vehmanen
parent 4bec5b292c
commit aff99b209f
1 changed files with 4 additions and 3 deletions

View File

@ -312,7 +312,6 @@ static int create_dai(struct comp_dev *parent_dev, struct copier_data *cd,
const struct comp_driver *drv;
struct ipc_config_dai dai;
int dai_count;
int ret;
int i;
drv = ipc4_get_drv((uint8_t *)&id);
@ -389,15 +388,17 @@ static int create_dai(struct comp_dev *parent_dev, struct copier_data *cd,
}
for (i = 0; i < dai_count; i++) {
int ret;
dai.dai_index = dai_index[i];
ret = init_dai(parent_dev, drv, config, copier, pipeline, &dai, type, i);
if (ret) {
comp_err(parent_dev, "failed to create dai");
break;
return ret;
}
}
return ret;
return 0;
}
static int init_pipeline_reg(struct comp_dev *dev)