Hello Ranjani Sridharan,
The patch 225f37b578a9: "ASoC: SOF: ipc4-pcm: reset all pipelines during FE DAI hw_free" from May 15, 2023, leads to the following Smatch static checker warning:
sound/soc/sof/intel/hda-dai-ops.c:215 hda_ipc4_pre_trigger() warn: inconsistent returns '&ipc4_data->pipeline_state_mutex'.
sound/soc/sof/intel/hda-dai-ops.c 178 static int hda_ipc4_pre_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai, 179 struct snd_pcm_substream *substream, int cmd) 180 { 181 struct sof_ipc4_fw_data *ipc4_data = sdev->private; 182 struct snd_sof_widget *pipe_widget; 183 struct sof_ipc4_pipeline *pipeline; 184 struct snd_sof_widget *swidget; 185 struct snd_soc_dapm_widget *w; 186 int ret; 187 188 w = snd_soc_dai_get_widget(cpu_dai, substream->stream); 189 swidget = w->dobj.private; 190 pipe_widget = swidget->spipe->pipe_widget; 191 pipeline = pipe_widget->private; 192 193 mutex_lock(&ipc4_data->pipeline_state_mutex); 194 195 switch (cmd) { 196 case SNDRV_PCM_TRIGGER_START: 197 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 198 break; 199 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 200 case SNDRV_PCM_TRIGGER_SUSPEND: 201 case SNDRV_PCM_TRIGGER_STOP: 202 ret = sof_ipc4_set_pipeline_state(sdev, pipe_widget->instance_id, 203 SOF_IPC4_PIPE_PAUSED); 204 if (ret < 0) 205 goto out;
Originally we propagated the error code back on this path, but now we are returning 0. Was this intentional?
206 207 pipeline->state = SOF_IPC4_PIPE_PAUSED; 208 break; 209 default: 210 dev_err(sdev->dev, "unknown trigger command %d\n", cmd); 211 return -EINVAL;
Needs an unlock before returning.
212 } 213 out: 214 mutex_unlock(&ipc4_data->pipeline_state_mutex); --> 215 return 0; 216 }
regards, dan carpenter