[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230519064404.1659637-1-harshit.m.mogalapalli@oracle.com>
Date: Thu, 18 May 2023 23:44:01 -0700
From: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Liam Girdwood <lgirdwood@...il.com>,
Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
Bard Liao <yung-chuan.liao@...ux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Daniel Baluta <daniel.baluta@....com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Rander Wang <rander.wang@...el.com>,
Jyri Sarha <jyri.sarha@...el.com>,
sound-open-firmware@...a-project.org, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org
Cc: harshit.m.mogalapalli@...cle.com, error27@...il.com,
dan.carpenter@...aro.org, kernel-janitors@...r.kernel.org
Subject: [PATCH next] ASoC: SOF: Intel: hda-dai: Fix locking in hda_ipc4_pre_trigger()
hda_ipc4_pre_trigger() has two issues:
1. In the default case, we are returning without unlocking the mutex.
2. In case SNDRV_PCM_TRIGGER_STOP: when ret is less than zero it goes
to out, unlocks but returns zero instead of a negative value.
Fix this by changing the final return value to 'ret' instead of zero,
and initialize 'ret' to zero in the start of the function.
Fixes: 225f37b578a9 ("ASoC: SOF: ipc4-pcm: reset all pipelines during FE DAI hw_free")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
---
Only compile tested. This is found using static anlysis with Smatch.
---
sound/soc/sof/intel/hda-dai-ops.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sof/intel/hda-dai-ops.c b/sound/soc/sof/intel/hda-dai-ops.c
index 5a508e118e3d..1e58256c8003 100644
--- a/sound/soc/sof/intel/hda-dai-ops.c
+++ b/sound/soc/sof/intel/hda-dai-ops.c
@@ -183,7 +183,7 @@ static int hda_ipc4_pre_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cp
struct sof_ipc4_pipeline *pipeline;
struct snd_sof_widget *swidget;
struct snd_soc_dapm_widget *w;
- int ret;
+ int ret = 0;
w = snd_soc_dai_get_widget(cpu_dai, substream->stream);
swidget = w->dobj.private;
@@ -208,11 +208,11 @@ static int hda_ipc4_pre_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cp
break;
default:
dev_err(sdev->dev, "unknown trigger command %d\n", cmd);
- return -EINVAL;
+ ret = -EINVAL;
}
out:
mutex_unlock(&ipc4_data->pipeline_state_mutex);
- return 0;
+ return ret;
}
static int hda_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai,
--
2.31.1
Powered by blists - more mailing lists