Skip to content

Commit c733e91

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 ad02735 commit c733e91

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
@@ -1357,13 +1357,14 @@ __cold static int ipc4_add_comp_dev(struct comp_dev *dev)
13571357
}
13581358

13591359
/* allocate the IPC component container */
1360-
icd = rzalloc(SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT,
1361-
sizeof(struct ipc_comp_dev));
1360+
icd = sof_heap_alloc(sof_sys_user_heap_get(), SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT,
1361+
sizeof(struct ipc_comp_dev), 0);
13621362
if (!icd) {
13631363
tr_err(&ipc_tr, "alloc failed");
1364-
rfree(icd);
1364+
sof_heap_free(sof_sys_user_heap_get(), icd);
13651365
return IPC4_OUT_OF_MEMORY;
13661366
}
1367+
memset(icd, 0, sizeof(*icd));
13671368

13681369
icd->cd = dev;
13691370
icd->type = COMP_TYPE_COMPONENT;

0 commit comments

Comments
 (0)