Skip to content

Commit 4abdf3d

Browse files
author
Jyri Sarha
committed
audio: copier: Fix resource leak from DMA sync code error handling
The code within #if CONFIG_HOST_DMA_STREAM_SYNCHRONIZATION should free host_common resources in case of failure. The commit fixes the issue. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 937d9e6 commit 4abdf3d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/audio/copier/copier_host.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ __cold int copier_host_create(struct processing_module *mod,
188188
goto e_data;
189189
}
190190
#if CONFIG_HOST_DMA_STREAM_SYNCHRONIZATION
191-
/* NOTE: Should use goto e_conv this #if section, not direct return */
192191
/* Size of a configuration without optional parameters. */
193192
const uint32_t basic_size = sizeof(*copier_cfg) +
194193
(copier_cfg->gtw_cfg.config_length - 1) * sizeof(uint32_t);
@@ -207,14 +206,16 @@ __cold int copier_host_create(struct processing_module *mod,
207206
if (value_ptr) {
208207
struct ipc4_copier_sync_group *sync_group;
209208

210-
if (value_size != sizeof(struct ipc4_copier_sync_group))
211-
return -EINVAL;
209+
if (value_size != sizeof(struct ipc4_copier_sync_group)) {
210+
ret = -EINVAL;
211+
goto e_conv;
212+
}
212213

213214
sync_group = (struct ipc4_copier_sync_group *)((void *)value_ptr);
214215

215216
ret = add_to_fpi_sync_group(dev, hd, sync_group);
216217
if (ret < 0)
217-
return ret;
218+
goto e_conv;
218219
}
219220
}
220221
#endif

0 commit comments

Comments
 (0)