@@ -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 );
@@ -245,8 +248,7 @@ void *mod_alloc_align(struct processing_module *mod, size_t size, size_t alignme
245248 }
246249
247250 /* Allocate memory for module */
248- ptr = rmalloc_align (SOF_MEM_FLAG_USER , size , alignment );
249-
251+ ptr = sof_heap_alloc (res -> heap , 0 , size , alignment );
250252 if (!ptr ) {
251253 comp_err (mod -> dev , "Failed to alloc %zu bytes %zu alignment for comp %#x." ,
252254 size , alignment , dev_comp_id (mod -> dev ));
@@ -275,8 +277,7 @@ EXPORT_SYMBOL(mod_alloc_align);
275277 * Like comp_data_blob_handler_new() but the handler is automatically freed.
276278 */
277279#if CONFIG_COMP_BLOB
278- struct comp_data_blob_handler *
279- mod_data_blob_handler_new (struct processing_module * mod )
280+ struct comp_data_blob_handler * mod_data_blob_handler_new (struct processing_module * mod )
280281{
281282 struct module_resources * res = & mod -> priv .resources ;
282283 struct comp_data_blob_handler * bhp ;
@@ -346,7 +347,7 @@ static int free_contents(struct processing_module *mod, struct module_resource *
346347
347348 switch (container -> type ) {
348349 case MOD_RES_HEAP :
349- rfree ( container -> ptr );
350+ sof_heap_free ( res -> heap , container -> ptr );
350351 res -> heap_usage -= container -> size ;
351352 return 0 ;
352353#if CONFIG_COMP_BLOB
@@ -587,6 +588,7 @@ int module_reset(struct processing_module *mod)
587588void mod_free_all (struct processing_module * mod )
588589{
589590 struct module_resources * res = & mod -> priv .resources ;
591+ struct k_heap * mod_heap = res -> heap ;
590592 struct list_item * list ;
591593 struct list_item * _list ;
592594
@@ -612,7 +614,7 @@ void mod_free_all(struct processing_module *mod)
612614 container_of (list , struct container_chunk , chunk_list );
613615
614616 list_item_del (& chunk -> chunk_list );
615- rfree ( chunk );
617+ sof_heap_free ( mod_heap , chunk );
616618 }
617619
618620 /* Make sure resource lists and accounting are reset */
0 commit comments