Merge "Asoc: dsp: Fix to check the list is empty or not"

This commit is contained in:
qctecmdr 2024-04-28 23:47:05 -07:00 • committed by Gerrit - the friendly Code Review server
commit fa68ddc57b
2 changed files with 14 additions and 1 deletions

View file

@ -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 <linux/init.h>
#include <linux/err.h>
@ -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) {

View file

@ -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) {