From: Tristan Madani The twl6040 codec driver initializes a delayed work for headset jack detection (hs_jack.work) but the component remove callback only frees the plug IRQ without cancelling the pending work. Free the IRQ first so that the threaded handler cannot schedule new work, then cancel any residual queued work synchronously. This ordering prevents the race where the handler fires between a cancel and the free_irq, re-arming the work after it was drained. Fixes: a2d2362edf9f ("ASoC: twl6040: Add jack support for headset and handset") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani --- sound/soc/codecs/twl6040.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 650836f9615fb..826bde1a9ba46 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -1136,6 +1136,7 @@ static void twl6040_remove(struct snd_soc_component *component) struct twl6040_data *priv = snd_soc_component_get_drvdata(component); free_irq(priv->plug_irq, component); + cancel_delayed_work_sync(&priv->hs_jack.work); } static const struct snd_soc_component_driver soc_component_dev_twl6040 = { -- 2.47.3