Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2132185 authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

ASoC: dapm: Fix double lock of dapm mutex



snd_soc_dapm_force_enable_pin takes the dapm mutex
internally and then calls into the function
snd_soc_dapm_force_enable_pin_unlocked, where the mutex
is again acquired resulting into a deadlock. Fix
the double lock by not acquiring the mutex within
the unlocked version of the function.

Change-Id: I6c68f1ef1645997bbcb1e5b197652c41baa609d3
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent cdecac51
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -3623,10 +3623,8 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
{
{
	struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
	struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);


	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
	if (!w) {
	if (!w) {
		dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin);
		dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin);
		mutex_unlock(&dapm->card->dapm_mutex);
		return -EINVAL;
		return -EINVAL;
	}
	}


@@ -3634,7 +3632,6 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
	w->connected = 1;
	w->connected = 1;
	w->force = 1;
	w->force = 1;
	dapm_mark_dirty(w, "force enable");
	dapm_mark_dirty(w, "force enable");
	mutex_unlock(&dapm->card->dapm_mutex);


	return 0;
	return 0;
}
}