@@ -131,11 +131,11 @@ __cold static int init_pipeline_reg(struct comp_dev *dev)
131131 * Sof host component can support this case so copier reuses host
132132 * component to support host gateway.
133133 */
134- __cold int copier_host_create (struct comp_dev * dev , struct copier_data * cd ,
134+ __cold int copier_host_create (struct processing_module * mod , struct copier_data * cd ,
135135 const struct ipc4_copier_module_cfg * copier_cfg ,
136136 struct pipeline * pipeline )
137137{
138- struct processing_module * mod = comp_mod ( dev ) ;
138+ struct comp_dev * dev = mod -> dev ;
139139 struct comp_ipc_config * config = & dev -> ipc_config ;
140140 struct ipc_config_host ipc_host ;
141141 struct host_data * hd ;
@@ -177,16 +177,17 @@ __cold int copier_host_create(struct comp_dev *dev, struct copier_data *cd,
177177 ipc_host .dma_buffer_size = copier_cfg -> gtw_cfg .dma_buffer_size ;
178178 ipc_host .feature_mask = copier_cfg -> copier_feature_mask ;
179179
180- hd = rzalloc ( SOF_MEM_FLAG_USER , sizeof (* hd ));
180+ hd = mod_zalloc ( mod , sizeof (* hd ));
181181 if (!hd )
182182 return - ENOMEM ;
183183
184184 ret = host_common_new (hd , dev , & ipc_host , config -> id );
185185 if (ret < 0 ) {
186186 comp_err (dev , "copier: host new failed with exit" );
187- goto e_data ;
187+ return ret ;
188188 }
189189#if CONFIG_HOST_DMA_STREAM_SYNCHRONIZATION
190+ /* NOTE: Should use goto e_conv this #if section, not direct return */
190191 /* Size of a configuration without optional parameters. */
191192 const uint32_t basic_size = sizeof (* copier_cfg ) +
192193 (copier_cfg -> gtw_cfg .config_length - 1 ) * sizeof (uint32_t );
@@ -248,22 +249,21 @@ __cold int copier_host_create(struct comp_dev *dev, struct copier_data *cd,
248249
249250e_conv :
250251 host_common_free (hd );
251- e_data :
252- rfree (hd );
253252
254253 return ret ;
255254}
256255
257- __cold void copier_host_free (struct copier_data * cd )
256+ __cold void copier_host_free (struct processing_module * mod )
258257{
258+ struct copier_data * cd = module_get_private_data (mod );
259+
259260 assert_can_be_cold ();
260261
261262#if CONFIG_HOST_DMA_STREAM_SYNCHRONIZATION
262263 if (cd -> hd -> is_grouped )
263264 delete_from_fpi_sync_group (cd -> hd );
264265#endif
265266 host_common_free (cd -> hd );
266- rfree (cd -> hd );
267267}
268268
269269/* This is called by DMA driver every time when DMA completes its current
0 commit comments