[PATCH 05/20] ASoC: es9356: Publish IRQ readiness after cache replay

From: Pengpeng Hou

Date: Fri Aug 28 2026 - 07:36:00 EST


es9356_sdca_dev_resume() clears its disable_irq software gate before
waiting for SoundWire initialization and before replaying the register
cache. If either operation fails, interrupt work can run against a
device that did not finish resume. The cache replay result itself is
also ignored.

Keep the IRQ gate set until both initialization and regcache_sync()
succeed. On replay failure, restore cache-only and dirty state and
return the error to device PM.

The issue was identified via static analysis and manually reviewed.

Fixes: 5d9cb740cd38 ("ASoC: es9356-sdca: Add ES9356 SDCA driver")

Assisted-by: LLM
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
sound/soc/codecs/es9356.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/es9356.c b/sound/soc/codecs/es9356.c
index 80db0f2f4aef..4eb240a0dd16 100644
--- a/sound/soc/codecs/es9356.c
+++ b/sound/soc/codecs/es9356.c
@@ -1107,9 +1107,6 @@ static int es9356_sdca_dev_resume(struct device *dev)
struct es9356_sdw_priv *es9356 = dev_get_drvdata(dev);
int ret;

- if (!slave->unattach_request)
- es9356->disable_irq = false;
-
ret = sdw_slave_wait_for_init(slave, es9356_PROBE_TIMEOUT);
if (ret) {
sdw_show_ping_status(slave->bus, true);
@@ -1117,7 +1114,16 @@ static int es9356_sdca_dev_resume(struct device *dev)
}

regcache_cache_only(es9356->regmap, false);
- regcache_sync(es9356->regmap);
+ ret = regcache_sync(es9356->regmap);
+ if (ret) {
+ regcache_cache_only(es9356->regmap, true);
+ regcache_mark_dirty(es9356->regmap);
+ return ret;
+ }
+
+ if (!slave->unattach_request)
+ scoped_guard(mutex, &es9356->disable_irq_lock)
+ es9356->disable_irq = false;
return 0;
}

--
2.43.0