Skip to contentSkip to conversation

ASoC: codecs: tlv320aic3x: Remove deadlock from snd_soc_dapm_put_volsw_aic3x()

PATCH In review Andreas Irestal 2 participants 2 messages Jun 5, 2013 – Jun 7, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: codecs: tlv320aic3x: Remove deadlock from snd_soc_dapm_put_volsw_aic3x()

From: Andreas Irestål <[email protected]>

When calling snd_soc_dapm_sync(), it eventually tries to lock the same mutex already locked in snd_soc_dapm_put_volsw_aic3x() and a deadlock occurs. By moving the mutex unlock to just before snd_soc_dapm_sync(), this deadlock is prevented. This problem was introduced in Linux 3.5

---
 sound/soc/codecs/tlv320aic3x.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
sound/soc/codecs/tlv320aic3x.c +5 -5
index 65d09d6..1514bf8 100644
@@ -187,14 +187,14 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
 
 			break;
 		}
-
-		if (found)
-			snd_soc_dapm_sync(widget->dapm);
 	}
 
-	ret = snd_soc_update_bits(widget->codec, reg, val_mask, val);
-
 	mutex_unlock(&widget->codec->mutex);
+
+	if (found)
+		snd_soc_dapm_sync(widget->dapm);
+
+	ret = snd_soc_update_bits_locked(widget->codec, reg, val_mask, val);
 	return ret;
 }
 
maintainer
#1 lore raw
Quoted 6 lines · Andreas Irestal

From: Andreas Irestål <[email protected]>

When calling snd_soc_dapm_sync(), it eventually tries to lock the same mutex already locked in snd_soc_dapm_put_volsw_aic3x() and a deadlock occurs. By moving the mutex unlock to just before snd_soc_dapm_sync(), this deadlock is prevented. This problem was introduced in Linux 3.5

Applied but as covered in Documentation/SubmittingPatches you should *always* CC maintainers on patches.