@@ -137,17 +137,20 @@ struct container_chunk {
137137static struct module_resource * container_get (struct processing_module * mod )
138138{
139139 struct module_resources * res = & mod -> priv .resources ;
140+ struct k_heap * mod_heap = res -> heap ;
140141 struct module_resource * container ;
141142
142143 if (list_is_empty (& res -> free_cont_list )) {
143- struct container_chunk * chunk = rzalloc ( SOF_MEM_FLAG_USER , sizeof (* chunk ));
144+ struct container_chunk * chunk = sof_heap_alloc ( mod_heap , 0 , sizeof (* chunk ), 0 );
144145 int i ;
145146
146147 if (!chunk ) {
147148 comp_err (mod -> dev , "allocating more containers failed" );
148149 return NULL ;
149150 }
150151
152+ memset (chunk , 0 , sizeof (* chunk ));
153+
151154 list_item_append (& chunk -> chunk_list , & res -> cont_chunk_list );
152155 for (i = 0 ; i < ARRAY_SIZE (chunk -> containers ); i ++ )
153156 list_item_append (& chunk -> containers [i ].list , & res -> free_cont_list );
@@ -246,8 +249,7 @@ void *mod_alloc_ext(struct processing_module *mod, uint32_t flags, size_t size,
246249 }
247250
248251 /* Allocate memory for module */
249- ptr = rmalloc_align (flags , size , alignment );
250-
252+ ptr = sof_heap_alloc (res -> heap , flags , size , alignment );
251253 if (!ptr ) {
252254 comp_err (mod -> dev , "Failed to alloc %zu bytes %zu alignment for comp %#x." ,
253255 size , alignment , dev_comp_id (mod -> dev ));
@@ -276,8 +278,7 @@ EXPORT_SYMBOL(mod_alloc_ext);
276278 * Like comp_data_blob_handler_new() but the handler is automatically freed.
277279 */
278280#if CONFIG_COMP_BLOB
279- struct comp_data_blob_handler *
280- mod_data_blob_handler_new (struct processing_module * mod )
281+ struct comp_data_blob_handler * mod_data_blob_handler_new (struct processing_module * mod )
281282{
282283 struct module_resources * res = & mod -> priv .resources ;
283284 struct comp_data_blob_handler * bhp ;
@@ -347,7 +348,7 @@ static int free_contents(struct processing_module *mod, struct module_resource *
347348
348349 switch (container -> type ) {
349350 case MOD_RES_HEAP :
350- rfree ( container -> ptr );
351+ sof_heap_free ( res -> heap , container -> ptr );
351352 res -> heap_usage -= container -> size ;
352353 return 0 ;
353354#if CONFIG_COMP_BLOB
@@ -588,6 +589,7 @@ int module_reset(struct processing_module *mod)
588589void mod_free_all (struct processing_module * mod )
589590{
590591 struct module_resources * res = & mod -> priv .resources ;
592+ struct k_heap * mod_heap = res -> heap ;
591593 struct list_item * list ;
592594 struct list_item * _list ;
593595
@@ -611,7 +613,7 @@ void mod_free_all(struct processing_module *mod)
611613 container_of (list , struct container_chunk , chunk_list );
612614
613615 list_item_del (& chunk -> chunk_list );
614- rfree ( chunk );
616+ sof_heap_free ( mod_heap , chunk );
615617 }
616618
617619 /* Make sure resource lists and accounting are reset */
0 commit comments