]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: qcom: q6apm-lpass-dai: Fix multiple graph opens
authorSrinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Thu, 2 Apr 2026 08:11:09 +0000 (08:11 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 2 Apr 2026 15:33:40 +0000 (16:33 +0100)
As prepare can be called mulitple times, this can result in multiple
graph opens for playback path.

This will result in a memory leaks, fix this by adding a check before
opening.

Fixes: be1fae62cf25 ("ASoC: q6apm-lpass-dai: close graph on prepare errors")
Cc: Stable@vger.kernel.org
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20260402081118.348071-5-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/qdsp6/q6apm-lpass-dais.c

index 5be37eeea329fcf35758430c9a374effdf4e2f79..ba64117b8cfe1381bec6ea4d7f0acf50f3407861 100644 (file)
@@ -181,7 +181,7 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream, struct s
         * It is recommend to load DSP with source graph first and then sink
         * graph, so sequence for playback and capture will be different
         */
-       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && dai_data->graph[dai->id] == NULL) {
                graph = q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id);
                if (IS_ERR(graph)) {
                        dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id);