[PATCH 3/4] ASoC: twl6040: cancel headset jack work on component remove
From: Tristan Madani
Date: Mon Oct 26 2026 - 07:36:04 EST
From: Tristan Madani <tristan@xxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx
Signed-off-by: Tristan Madani <tristan@xxxxxxxxxxxxxxxxxxx>
---
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