Skip to contentSkip to conversation

sound/soc/sof/ipc4-topology.c:1101 sof_ipc4_widget_setup_comp_src() warn: missing error code 'ret'

PATCH kernel test robot 1 participant 1 message Jun 11

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

BCC: [email protected]
CC: [email protected]
TO: Peter Ujfalusi <[email protected]>
CC: Mark Brown <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   abe651837cb394f76d738a7a747322fca3bf17ba
commit: 21a5adffad463344e9aca6ee697f45a079cb3ef5 [7077/13002] ASoC: SOF: ipc4-topology: Validate the number of in/out formats for src/asrc

:::::: branch date: 14 hours ago
:::::: commit date: 2 weeks ago
config: i386-randconfig-r073-20260611 (https://download.01.org/0day-ci/archive/20260611/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9185-gbcc58b9c

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
sound/soc/sof/ipc4-topology.c:1101 sof_ipc4_widget_setup_comp_src() warn: missing error code 'ret' sound/soc/sof/ipc4-topology.c:1153 sof_ipc4_widget_setup_comp_asrc() warn: missing error code 'ret'

vim +/ret +1101 sound/soc/sof/ipc4-topology.c

4d4ba014ac4b377 Ranjani Sridharan 2022-06-08  1074  
b85f4fc40d56f69 Rander Wang       2022-07-15  1075  static int sof_ipc4_widget_setup_comp_src(struct snd_sof_widget *swidget)
b85f4fc40d56f69 Rander Wang       2022-07-15  1076  {
b85f4fc40d56f69 Rander Wang       2022-07-15  1077  	struct snd_soc_component *scomp = swidget->scomp;
0376b995bb7a65f Ranjani Sridharan 2023-11-24  1078  	struct snd_sof_pipeline *spipe = swidget->spipe;
b85f4fc40d56f69 Rander Wang       2022-07-15  1079  	struct sof_ipc4_src *src;
b85f4fc40d56f69 Rander Wang       2022-07-15  1080  	int ret;
b85f4fc40d56f69 Rander Wang       2022-07-15  1081  
b85f4fc40d56f69 Rander Wang       2022-07-15  1082  	dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
b85f4fc40d56f69 Rander Wang       2022-07-15  1083  
bf4afc53b77aeaa Linus Torvalds    2026-02-21  1084  	src = kzalloc_obj(*src);
b85f4fc40d56f69 Rander Wang       2022-07-15  1085  	if (!src)
b85f4fc40d56f69 Rander Wang       2022-07-15  1086  		return -ENOMEM;
b85f4fc40d56f69 Rander Wang       2022-07-15  1087  
b85f4fc40d56f69 Rander Wang       2022-07-15  1088  	swidget->private = src;
b85f4fc40d56f69 Rander Wang       2022-07-15  1089  
c447636970e3409 Peter Ujfalusi    2023-11-29  1090  	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &src->available_fmt,
c447636970e3409 Peter Ujfalusi    2023-11-29  1091  				     &src->data.base_config);
b85f4fc40d56f69 Rander Wang       2022-07-15  1092  	if (ret)
b85f4fc40d56f69 Rander Wang       2022-07-15  1093  		goto err;
b85f4fc40d56f69 Rander Wang       2022-07-15  1094  
21a5adffad46334 Peter Ujfalusi    2026-05-26  1095  	if (!src->available_fmt.num_input_formats ||
21a5adffad46334 Peter Ujfalusi    2026-05-26  1096  	    !src->available_fmt.num_output_formats) {
21a5adffad46334 Peter Ujfalusi    2026-05-26  1097  		dev_err(scomp->dev,
21a5adffad46334 Peter Ujfalusi    2026-05-26  1098  			"Invalid number of formats: input: %d, output: %d\n",
21a5adffad46334 Peter Ujfalusi    2026-05-26  1099  			src->available_fmt.num_input_formats,
21a5adffad46334 Peter Ujfalusi    2026-05-26  1100  			src->available_fmt.num_output_formats);
21a5adffad46334 Peter Ujfalusi    2026-05-26 @1101  		goto err;
21a5adffad46334 Peter Ujfalusi    2026-05-26  1102  	}
21a5adffad46334 Peter Ujfalusi    2026-05-26  1103  
c447636970e3409 Peter Ujfalusi    2023-11-29  1104  	ret = sof_update_ipc_object(scomp, &src->data, SOF_SRC_TOKENS, swidget->tuples,
ecdb10df7e0d83b Yang Yingliang    2022-08-18  1105  				    swidget->num_tuples, sizeof(*src), 1);
b85f4fc40d56f69 Rander Wang       2022-07-15  1106  	if (ret) {
b85f4fc40d56f69 Rander Wang       2022-07-15  1107  		dev_err(scomp->dev, "Parsing SRC tokens failed\n");
b85f4fc40d56f69 Rander Wang       2022-07-15  1108  		goto err;
b85f4fc40d56f69 Rander Wang       2022-07-15  1109  	}
b85f4fc40d56f69 Rander Wang       2022-07-15  1110  
0376b995bb7a65f Ranjani Sridharan 2023-11-24  1111  	spipe->core_mask |= BIT(swidget->core);
0376b995bb7a65f Ranjani Sridharan 2023-11-24  1112  
c447636970e3409 Peter Ujfalusi    2023-11-29  1113  	dev_dbg(scomp->dev, "SRC sink rate %d\n", src->data.sink_rate);
b85f4fc40d56f69 Rander Wang       2022-07-15  1114  
b85f4fc40d56f69 Rander Wang       2022-07-15  1115  	ret = sof_ipc4_widget_setup_msg(swidget, &src->msg);
b85f4fc40d56f69 Rander Wang       2022-07-15  1116  	if (ret)
b85f4fc40d56f69 Rander Wang       2022-07-15  1117  		goto err;
b85f4fc40d56f69 Rander Wang       2022-07-15  1118  
b85f4fc40d56f69 Rander Wang       2022-07-15  1119  	return 0;
b85f4fc40d56f69 Rander Wang       2022-07-15  1120  err:
b85f4fc40d56f69 Rander Wang       2022-07-15  1121  	sof_ipc4_free_audio_fmt(&src->available_fmt);
b85f4fc40d56f69 Rander Wang       2022-07-15  1122  	kfree(src);
b85f4fc40d56f69 Rander Wang       2022-07-15  1123  	swidget->private = NULL;
b85f4fc40d56f69 Rander Wang       2022-07-15  1124  	return ret;
b85f4fc40d56f69 Rander Wang       2022-07-15  1125  }
b85f4fc40d56f69 Rander Wang       2022-07-15  1126  
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1127  static int sof_ipc4_widget_setup_comp_asrc(struct snd_sof_widget *swidget)
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1128  {
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1129  	struct snd_soc_component *scomp = swidget->scomp;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1130  	struct snd_sof_pipeline *spipe = swidget->spipe;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1131  	struct sof_ipc4_asrc *asrc;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1132  	int ret;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1133  
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1134  	dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1135  
bf4afc53b77aeaa Linus Torvalds    2026-02-21  1136  	asrc = kzalloc_obj(*asrc);
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1137  	if (!asrc)
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1138  		return -ENOMEM;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1139  
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1140  	swidget->private = asrc;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1141  
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1142  	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &asrc->available_fmt,
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1143  				     &asrc->data.base_config);
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1144  	if (ret)
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1145  		goto err;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1146  
21a5adffad46334 Peter Ujfalusi    2026-05-26  1147  	if (!asrc->available_fmt.num_input_formats ||
21a5adffad46334 Peter Ujfalusi    2026-05-26  1148  	    !asrc->available_fmt.num_output_formats) {
21a5adffad46334 Peter Ujfalusi    2026-05-26  1149  		dev_err(scomp->dev,
21a5adffad46334 Peter Ujfalusi    2026-05-26  1150  			"Invalid number of formats: input: %d, output: %d\n",
21a5adffad46334 Peter Ujfalusi    2026-05-26  1151  			asrc->available_fmt.num_input_formats,
21a5adffad46334 Peter Ujfalusi    2026-05-26  1152  			asrc->available_fmt.num_output_formats);
21a5adffad46334 Peter Ujfalusi    2026-05-26 @1153  		goto err;
21a5adffad46334 Peter Ujfalusi    2026-05-26  1154  	}
21a5adffad46334 Peter Ujfalusi    2026-05-26  1155  
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1156  	ret = sof_update_ipc_object(scomp, &asrc->data, SOF_ASRC_TOKENS, swidget->tuples,
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1157  				    swidget->num_tuples, sizeof(*asrc), 1);
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1158  	if (ret) {
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1159  		dev_err(scomp->dev, "Parsing ASRC tokens failed\n");
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1160  		goto err;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1161  	}
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1162  
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1163  	spipe->core_mask |= BIT(swidget->core);
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1164  
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1165  	dev_dbg(scomp->dev, "ASRC sink rate %d, mode 0x%08x\n",
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1166  		asrc->data.out_freq, asrc->data.asrc_mode);
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1167  
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1168  	ret = sof_ipc4_widget_setup_msg(swidget, &asrc->msg);
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1169  	if (ret)
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1170  		goto err;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1171  
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1172  	return 0;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1173  err:
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1174  	sof_ipc4_free_audio_fmt(&asrc->available_fmt);
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1175  	kfree(asrc);
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1176  	swidget->private = NULL;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1177  	return ret;
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1178  }
f9c7c093797fc00 Seppo Ingalsuo    2025-06-19  1179  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki