Skip to content

Commit 7846e39

Browse files
author
Jyri Sarha
committed
Audio: mixin_mixout: Memory, blob, and fast_get allocs to module API
Allocate all memory, blob handlers, and fast_get() buffers through module API mod_alloc() and friends and remove all redundant rfree(), comp_data_blob_handler_free(), and fast_put() calls from module unload functions and init error branches. When resources are allocated through module API functions they are automatically freed when the module is unloaded. This simplifies error handling and unloading process. Signed-off-by: Jyri Sarha <[email protected]>
1 parent eba5799 commit 7846e39

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/audio/mixin_mixout/mixin_mixout.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <rtos/panic.h>
1414
#include <sof/ipc/msg.h>
1515
#include <sof/ipc/notification_pool.h>
16-
#include <rtos/alloc.h>
1716
#include <rtos/init.h>
1817
#include <sof/lib/uuid.h>
1918
#include <sof/list.h>
@@ -141,7 +140,7 @@ static int mixin_init(struct processing_module *mod)
141140

142141
comp_dbg(dev, "entry");
143142

144-
md = rzalloc(SOF_MEM_FLAG_USER, sizeof(*md));
143+
md = mod_zalloc(mod, sizeof(*md));
145144
if (!md)
146145
return -ENOMEM;
147146

@@ -168,7 +167,7 @@ static int mixout_init(struct processing_module *mod)
168167

169168
comp_dbg(dev, "entry");
170169

171-
mo_data = rzalloc(SOF_MEM_FLAG_USER, sizeof(*mo_data));
170+
mo_data = mod_zalloc(mod, sizeof(*mo_data));
172171
if (!mo_data)
173172
return -ENOMEM;
174173

@@ -182,17 +181,11 @@ static int mixout_init(struct processing_module *mod)
182181

183182
static int mixin_free(struct processing_module *mod)
184183
{
185-
struct mixin_data *md = module_get_private_data(mod);
186-
187-
rfree(md);
188-
189184
return 0;
190185
}
191186

192187
static int mixout_free(struct processing_module *mod)
193188
{
194-
rfree(module_get_private_data(mod));
195-
196189
return 0;
197190
}
198191

0 commit comments

Comments
 (0)