From: Tristan Madani twl6040_remove() frees the plug detect IRQ but does not cancel the delayed work that the IRQ handler schedules. If the work is still pending after free_irq() returns, it fires on freed memory. Add cancel_delayed_work_sync() after free_irq() to drain any residual work. The IRQ is freed first to stop the producer, then the work is 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