Skip to contentSkip to conversation

ASoC: soc-compress: Reposition and add pcm_mutex

PATCH In review 강신형 2 participants 2 messages Dec 5, 2022 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20221205051742epcas2p4e4724276da916d308b9c1a4aaccca672@epcas2p4.samsung.com

강신형

author
#1 lore raw

PATCH 1/1 ASoC: soc-compress: Reposition and add pcm_mutex

From 3f8fd1efedd77331d948b16a8e44ffa6cf0e811f Mon Sep 17 00:00:00 2001

From: "s47.kang" <[email protected]>

Date: Fri, 2 Dec 2022 18:32:35 +0900

Subject: [PATCH] [COMMON] ASoC: soc-compress.c: Reposition and add pcm_mutex.

If panic_on_warn is set and compress stream(DPCM) is started,

then kernel panic will occurs because card->pcm_mutex isn't held appropriately in

soc_compr_set_params_fe, soc_compr_open_fe and soc_compr_free_fe.

So, I reposition and add pcm_mutex to resolve lockdep error.

Change-Id: I15981b4f09b0bff37e7e98e6ee1f809339b2bcc4

---

sound/soc/soc-compress.c | 9 ++++++---

1 file changed, 6 insertions(+), 3 deletions(-)
sound/soc/soc-compress.c +0 -0

index 870f13e1d389..7bce5088b455 100644

--- a/sound/soc/soc-compress.c

+++ b/sound/soc/soc-compress.c

@@ -149,6 +149,8 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)

         if (ret < 0)

                    goto be_err;

+ mutex_lock_nested(&fe->card->pcm_mutex, fe->card->pcm_subclass);

+

         /* calculate valid and active FE <-> BE dpcms */

         dpcm_process_paths(fe, stream, &list, 1);

         fe->dpcm[stream].runtime = fe_substream->runtime;

@@ -184,7 +186,6 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)

         fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;

         fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;

- mutex_lock_nested(&fe->card->pcm_mutex, fe->card->pcm_subclass);

         snd_soc_runtime_activate(fe, stream);

         mutex_unlock(&fe->card->pcm_mutex);

@@ -215,7 +216,6 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)

          mutex_lock_nested(&fe->card->pcm_mutex, fe->card->pcm_subclass);

         snd_soc_runtime_deactivate(fe, stream);

- mutex_unlock(&fe->card->pcm_mutex);

          fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;

@@ -234,6 +234,8 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)

          dpcm_be_disconnect(fe, stream);

+ mutex_unlock(&fe->card->pcm_mutex);

+

         fe->dpcm[stream].runtime = NULL;

          snd_soc_link_compr_shutdown(cstream, 0);

@@ -409,8 +411,9 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,

         ret = snd_soc_link_compr_set_params(cstream);

         if (ret < 0)

                    goto out;

-

+ mutex_lock_nested(&fe->card->pcm_mutex, fe->card->pcm_subclass);

         dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START);

+ mutex_unlock(&fe->card->pcm_mutex);

         fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;

out:

--

2.21.0

maintainer
#2 lore raw
Quoted 4 lines · ������

From 3f8fd1efedd77331d948b16a8e44ffa6cf0e811f Mon Sep 17 00:00:00 2001

From: "s47.kang" <[email protected]>

Quoted 8 lines

Date: Fri, 2 Dec 2022 18:32:35 +0900

Subject: [PATCH] [COMMON] ASoC: soc-compress.c: Reposition and add pcm_mutex.

If panic_on_warn is set and compress stream(DPCM) is started,

This mail is still really badly corrupted, it's got lots of blank lines added, other whitespace damage and I think is word wrapped as well.