@@ -72,20 +72,10 @@ static int mfcc_init(struct processing_module *mod)
7272{
7373 struct module_data * md = & mod -> priv ;
7474 struct comp_dev * dev = mod -> dev ;
75- struct module_config * cfg = & md -> cfg ;
7675 struct mfcc_comp_data * cd = NULL ;
77- size_t bs = cfg -> size ;
78- int ret ;
7976
8077 comp_info (dev , "entry" );
8178
82- /* Check first that configuration blob size is sane */
83- if (bs > SOF_MFCC_CONFIG_MAX_SIZE ) {
84- comp_err (dev , "error: configuration blob size %zu exceeds %d" ,
85- bs , SOF_MFCC_CONFIG_MAX_SIZE );
86- return - EINVAL ;
87- }
88-
8979 cd = mod_zalloc (mod , sizeof (* cd ));
9080 if (!cd )
9181 return - ENOMEM ;
@@ -95,25 +85,11 @@ static int mfcc_init(struct processing_module *mod)
9585 cd -> model_handler = mod_data_blob_handler_new (mod );
9686 if (!cd -> model_handler ) {
9787 comp_err (dev , "comp_data_blob_handler_new() failed." );
98- ret = - ENOMEM ;
99- goto err ;
100- }
101-
102- /* Get configuration data */
103- ret = comp_init_data_blob (cd -> model_handler , bs , cfg -> init_data );
104- if (ret < 0 ) {
105- comp_err (mod -> dev , "comp_init_data_blob() failed." );
106- goto err_init ;
88+ mod_free (mod , cd );
89+ return - ENOMEM ;
10790 }
10891
10992 return 0 ;
110-
111- err_init :
112- comp_data_blob_handler_free (cd -> model_handler );
113-
114- err :
115- mod_free (mod , cd );
116- return ret ;
11793}
11894
11995static int mfcc_free (struct processing_module * mod )
@@ -183,6 +159,7 @@ static int mfcc_prepare(struct processing_module *mod,
183159 struct comp_dev * dev = mod -> dev ;
184160 enum sof_ipc_frame source_format ;
185161 enum sof_ipc_frame sink_format ;
162+ size_t data_size ;
186163 uint32_t sink_period_bytes ;
187164 int ret ;
188165
@@ -211,10 +188,10 @@ static int mfcc_prepare(struct processing_module *mod,
211188 goto err ;
212189 }
213190
214- cd -> config = comp_get_data_blob (cd -> model_handler , NULL , NULL );
191+ cd -> config = comp_get_data_blob (cd -> model_handler , & data_size , NULL );
215192
216193 /* Initialize MFCC, max_frames is set to dev->frames + 4 */
217- if (cd -> config ) {
194+ if (cd -> config && data_size > 0 ) {
218195 ret = mfcc_setup (mod , dev -> frames + 4 , audio_stream_get_rate (& sourceb -> stream ),
219196 audio_stream_get_channels (& sourceb -> stream ));
220197 if (ret < 0 ) {
0 commit comments