@@ -531,9 +531,9 @@ int src_params_general(struct processing_module *mod,
531531 }
532532
533533 /* free any existing delay lines. TODO reuse if same size */
534- rfree ( cd -> delay_lines );
534+ mod_free ( mod , cd -> delay_lines );
535535
536- cd -> delay_lines = rballoc ( SOF_MEM_FLAG_USER , delay_lines_size );
536+ cd -> delay_lines = mod_alloc ( mod , delay_lines_size );
537537 if (!cd -> delay_lines ) {
538538 comp_err (dev , "src_params(): failed to alloc cd->delay_lines, delay_lines_size = %zu" ,
539539 delay_lines_size );
@@ -594,7 +594,7 @@ int src_param_set(struct comp_dev *dev, struct comp_data *cd)
594594 return 0 ;
595595}
596596
597- int src_allocate_copy_stages (struct comp_dev * dev , struct src_param * prm ,
597+ int src_allocate_copy_stages (struct processing_module * mod , struct src_param * prm ,
598598 const struct src_stage * stage_src1 ,
599599 const struct src_stage * stage_src2 )
600600{
@@ -607,10 +607,9 @@ int src_allocate_copy_stages(struct comp_dev *dev, struct src_param *prm,
607607 size_t tap_size = sizeof (int32_t );
608608#endif
609609
610- stage_dst = rmalloc (SOF_MEM_FLAG_USER ,
611- 2 * sizeof (* stage_dst ));
610+ stage_dst = mod_alloc (mod , 2 * sizeof (* stage_dst ));
612611 if (!stage_dst ) {
613- comp_err (dev , "failed to allocate stages" );
612+ comp_err (mod -> dev , "failed to allocate stages" );
614613 return - ENOMEM ;
615614 }
616615
@@ -622,20 +621,18 @@ int src_allocate_copy_stages(struct comp_dev *dev, struct src_param *prm,
622621 coef_size [1 ] = tap_size * stage_src2 -> filter_length ;
623622
624623 if (coef_size [0 ] == 0 || coef_size [1 ] == 0 ) {
625- comp_err (dev ,
624+ comp_err (mod -> dev ,
626625 "illegal zero coefficient vector size for unsupported conversion request %d to %d" ,
627626 prm -> in_fs [prm -> idx_in ], prm -> out_fs [prm -> idx_out ]);
628- rfree (stage_dst );
629627 return - EINVAL ;
630628 }
631629
632630 stage_dst [0 ].coefs = fast_get (stage_src1 -> coefs , coef_size [0 ]);
633631 stage_dst [1 ].coefs = fast_get (stage_src2 -> coefs , coef_size [1 ]);
634632
635633 if (!stage_dst [0 ].coefs || !stage_dst [1 ].coefs ) {
636- comp_err (dev , "failed to allocate coefficients" );
634+ comp_err (mod -> dev , "failed to allocate coefficients" );
637635 fast_put (stage_dst [0 ].coefs );
638- rfree (stage_dst );
639636 return - ENOMEM ;
640637 }
641638
@@ -707,21 +704,19 @@ int src_reset(struct processing_module *mod)
707704
708705__cold int src_free (struct processing_module * mod )
709706{
707+ #if CONFIG_FAST_GET
710708 struct comp_data * cd = module_get_private_data (mod );
709+ #endif
711710
712711 assert_can_be_cold ();
713712
714713 comp_info (mod -> dev , "src_free()" );
715714
716- /* Free dynamically reserved buffers for SRC algorithm */
717- rfree (cd -> delay_lines );
718715#if CONFIG_FAST_GET
719716 if (cd -> param .stage1 ) {
720717 fast_put (cd -> param .stage1 -> coefs );
721718 fast_put (cd -> param .stage2 -> coefs );
722719 }
723- rfree ((void * )cd -> param .stage1 );
724720#endif
725- rfree (cd );
726721 return 0 ;
727722}
0 commit comments