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

Commit d456c253 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Greg Kroah-Hartman
Browse files

ASoC: wm8994: Fix potential deadlock



[ Upstream commit 9529dc167ffcdfd201b9f0eda71015f174095f7e ]

Fix this by dropping wm8994->accdet_lock while calling
cancel_delayed_work_sync(&wm8994->mic_work) in wm1811_jackdet_irq().

Fixes: c0cc3f16 ("ASoC: wm8994: Allow a delay between jack insertion and microphone detect")
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221209091657.1183-1-m.szyprowski@samsung.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 2705bb16
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3711,7 +3711,12 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
	} else {
		dev_dbg(component->dev, "Jack not detected\n");

		/* Release wm8994->accdet_lock to avoid deadlock:
		 * cancel_delayed_work_sync() takes wm8994->mic_work internal
		 * lock and wm1811_mic_work takes wm8994->accdet_lock */
		mutex_unlock(&wm8994->accdet_lock);
		cancel_delayed_work_sync(&wm8994->mic_work);
		mutex_lock(&wm8994->accdet_lock);

		snd_soc_component_update_bits(component, WM8958_MICBIAS2,
				    WM8958_MICB2_DISCH, WM8958_MICB2_DISCH);