mirror of https://github.com/thesofproject/sof.git
keyword: check test_keyword_get_threshold() return value
test_keyword_get_threshold() can return errors, make sure to check its return value before using it. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
8798dd508f
commit
02d7974cf7
|
@ -243,8 +243,14 @@ static int test_keyword_apply_config(struct comp_dev *dev,
|
|||
cd->config.activation_shift = ACTIVATION_DEFAULT_SHIFT;
|
||||
|
||||
if (!cd->config.activation_threshold) {
|
||||
cd->config.activation_threshold =
|
||||
test_keyword_get_threshold(dev, sample_width);
|
||||
ret = test_keyword_get_threshold(dev, sample_width);
|
||||
if (ret < 0) {
|
||||
comp_err(dev, "test_keyword_apply_config(): unsupported sample width %u",
|
||||
sample_width);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cd->config.activation_threshold = ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -412,8 +418,14 @@ static int test_keyword_params(struct comp_dev *dev,
|
|||
cd->keyphrase_samples = KEYPHRASE_DEFAULT_PREAMBLE_LENGTH;
|
||||
}
|
||||
|
||||
cd->config.activation_threshold =
|
||||
test_keyword_get_threshold(dev, params->sample_valid_bytes * 8);
|
||||
err = test_keyword_get_threshold(dev, params->sample_valid_bytes * 8);
|
||||
if (err < 0) {
|
||||
comp_err(dev, "test_keyword_params(): unsupported sample width %u",
|
||||
params->sample_valid_bytes * 8);
|
||||
return err;
|
||||
}
|
||||
|
||||
cd->config.activation_threshold = err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -663,8 +675,15 @@ static int test_keyword_prepare(struct comp_dev *dev)
|
|||
/* Default threshold value has to be changed
|
||||
* according to host new format.
|
||||
*/
|
||||
cd->config.activation_threshold =
|
||||
test_keyword_get_threshold(dev, valid_bits);
|
||||
int ret = test_keyword_get_threshold(dev, valid_bits);
|
||||
|
||||
if (ret < 0) {
|
||||
comp_err(dev, "test_keyword_prepare(): unsupported sample width %u",
|
||||
valid_bits);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cd->config.activation_threshold = ret;
|
||||
}
|
||||
|
||||
cd->data_blob = comp_get_data_blob(cd->model_handler,
|
||||
|
|
Loading…
Reference in New Issue