Skip to content

Commit 67c3a92

Browse files
committed
ipc: ipc4: use sof_heap_alloc in ipc4_add_comp_dev()
Use sof_heap_alloc() and the new sof_sys_user_heap_get() to route the allocs to correct heap based on SOF build options. If the audio pipeline code is run completely in user-space, a compatible heap should be used. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent f42df88 commit 67c3a92

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/ipc/ipc4/helper.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,13 +1349,14 @@ __cold static int ipc4_add_comp_dev(struct comp_dev *dev)
13491349
}
13501350

13511351
/* allocate the IPC component container */
1352-
icd = rzalloc(SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT,
1353-
sizeof(struct ipc_comp_dev));
1352+
icd = sof_heap_alloc(sof_sys_user_heap_get(), SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT,
1353+
sizeof(struct ipc_comp_dev), 0);
13541354
if (!icd) {
13551355
tr_err(&ipc_tr, "alloc failed");
1356-
rfree(icd);
1356+
sof_heap_free(sof_sys_user_heap_get(), icd);
13571357
return IPC4_OUT_OF_MEMORY;
13581358
}
1359+
memset(icd, 0, sizeof(*icd));
13591360

13601361
icd->cd = dev;
13611362
icd->type = COMP_TYPE_COMPONENT;

0 commit comments

Comments
 (0)