diff --git a/asoc/msm-lsm-client.c b/asoc/msm-lsm-client.c index 443f62e84d01..9b82d8c49a51 100644 --- a/asoc/msm-lsm-client.c +++ b/asoc/msm-lsm-client.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. - * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. */ #include #include @@ -879,6 +879,13 @@ static int msm_lsm_dereg_model(struct snd_pcm_substream *substream, if (p_info->model_id != 0 && p_info->param_type == LSM_DEREG_MULTI_SND_MODEL) { + + if(list_empty(&client->stage_cfg[p_info->stage_idx].sound_models)) { + pr_err("%s: sound_models list is empty \n", + __func__); + return -EINVAL; + } + list_for_each_entry(sm, &client->stage_cfg[p_info->stage_idx].sound_models, list) { diff --git a/dsp/q6lsm.c b/dsp/q6lsm.c index f79298d0c31d..175c8fcb1a7e 100644 --- a/dsp/q6lsm.c +++ b/dsp/q6lsm.c @@ -2460,6 +2460,12 @@ int q6lsm_set_one_param(struct lsm_client *client, sizeof(struct param_hdr_v2); if (param_type == LSM_REG_MULTI_SND_MODEL) { + if(list_empty(&client->stage_cfg[p_info->stage_idx].sound_models)) { + pr_err("%s: sound_models list is empty \n", + __func__); + return -EINVAL; + } + list_for_each_entry(sm, &client->stage_cfg[p_info->stage_idx].sound_models, list) {