[PATCH 2/6] ASoC: rt711-sdw: always cancel jack work on remove
From: Jiale Yao
Date: Fri Sep 25 2026 - 10:52:02 EST
rt711_sdw_remove() cancels the jack and calibration work only when
hw_init is true. rt711_update_status() clears hw_init when the SoundWire
slave becomes unattached, but work may already have been queued by
rt711_interrupt_callback() or the jack initialization path.
A remove after that status update can therefore skip the cancellation and
leave work pending after the codec private data has been freed.
The work objects are initialized during probe, so cancel them
unconditionally instead of relying on the mutable hw_init state.
Fixes: ac63716da307 ("ASoC: Realtek/Maxim SoundWire codecs: disable pm_runtime on remove")
Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
---
sound/soc/codecs/rt711-sdw.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c
index 4ad2b1da1954..798d181d5c90 100644
--- a/sound/soc/codecs/rt711-sdw.c
+++ b/sound/soc/codecs/rt711-sdw.c
@@ -461,11 +461,9 @@ static void rt711_sdw_remove(struct sdw_slave *slave)
{
struct rt711_priv *rt711 = dev_get_drvdata(&slave->dev);
- if (rt711->hw_init) {
- cancel_delayed_work_sync(&rt711->jack_detect_work);
- cancel_delayed_work_sync(&rt711->jack_btn_check_work);
- cancel_work_sync(&rt711->calibration_work);
- }
+ cancel_delayed_work_sync(&rt711->jack_detect_work);
+ cancel_delayed_work_sync(&rt711->jack_btn_check_work);
+ cancel_work_sync(&rt711->calibration_work);
pm_runtime_disable(&slave->dev);
--
2.34.1