Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/audio/copier/copier_dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ __cold int copier_dai_create(struct comp_dev *dev, struct copier_data *cd,
dai_count);
if (ret) {
comp_err(dev, "failed to create dai");
return ret;
goto err_free_dais;
}
}

Expand All @@ -395,14 +395,15 @@ __cold int copier_dai_create(struct comp_dev *dev, struct copier_data *cd,
if (!cd->converter[IPC4_COPIER_GATEWAY_PIN]) {
comp_err(dev, "failed to get converter type %d, dir %d",
cd->gtw_type, dai.direction);
return -EINVAL;
ret = -EINVAL;
goto err_free_dais;
}

/* create multi_endpoint_buffer for ALH multi-gateway case */
if (dai_count > 1) {
ret = create_multi_endpoint_buffer(dev, cd, copier);
if (ret < 0)
return ret;
goto err_free_dais;
}

if (cd->direction == SOF_IPC_STREAM_PLAYBACK) {
Expand All @@ -415,6 +416,15 @@ __cold int copier_dai_create(struct comp_dev *dev, struct copier_data *cd,
}

return 0;

err_free_dais:
/* The copier is not created, so copier_free() will never run for it.
* Release the DAI, DMA and DAI group references taken by the endpoints
* that were already initialized, they are not covered by the module
* memory cleanup.
*/
copier_dai_free(mod);
return ret;
}

__cold void copier_dai_free(struct processing_module *mod)
Expand Down
Loading