[PATCH v3 06/12] ASoC: mediatek: mt8189: Propagate runtime resume errors
From: phucduc . bui
Date: Wed Sep 16 2026 - 01:03:00 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
mt8189_afe_runtime_resume() currently ignores errors from regmap
operations and mt8189_afe_enable_main_clock().
Propagate these errors and clean up the state before returning the
error.
Fixes: 7eb153585598 ("ASoC: mediatek: mt8189: add platform driver")
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
Changes in v2:
- Update the names of the goto labels.
Changes in v3:
- Add Angelo's Reviewed-by tag.
- Restore the existing afe->regmap checks.
sound/soc/mediatek/mt8189/mt8189-afe-pcm.c | 32 ++++++++++++++++++----
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
index 77cf2b604f6c..39cc2804ad4c 100644
--- a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
+++ b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
@@ -2332,20 +2332,40 @@ static int mt8189_afe_runtime_resume(struct device *dev)
}
regcache_cache_only(afe->regmap, false);
- regcache_sync(afe->regmap);
+ ret = regcache_sync(afe->regmap);
+ if (ret)
+ goto err_set_cache_only;
/* set audio 26M request */
- regmap_update_bits(afe->regmap, AFE_SPM_CONTROL_REQ, 0x1, 0x1);
- regmap_update_bits(afe->regmap, AFE_CBIP_CFG0, 0x1, 0x1);
+ ret = regmap_update_bits(afe->regmap, AFE_SPM_CONTROL_REQ, 0x1, 0x1);
+ if (ret)
+ goto err_set_cache_only;
+
+ ret = regmap_update_bits(afe->regmap, AFE_CBIP_CFG0, 0x1, 0x1);
+ if (ret)
+ goto err_clear_26m_req;
/* force cpu use 8_24 format when writing 32bit data */
- regmap_update_bits(afe->regmap, AFE_MEMIF_CON0,
- CPU_HD_ALIGN_MASK_SFT, 0 << CPU_HD_ALIGN_SFT);
+ ret = regmap_update_bits(afe->regmap, AFE_MEMIF_CON0,
+ CPU_HD_ALIGN_MASK_SFT, 0 << CPU_HD_ALIGN_SFT);
+ if (ret)
+ goto err_clear_26m_req;
/* enable AFE */
- mt8189_afe_enable_main_clock(afe);
+ ret = mt8189_afe_enable_main_clock(afe);
+ if (ret)
+ goto err_clear_26m_req;
return 0;
+
+err_clear_26m_req:
+ regmap_update_bits(afe->regmap,
+ AFE_SPM_CONTROL_REQ, 0x1, 0x0);
+err_set_cache_only:
+ regcache_cache_only(afe->regmap, true);
+ mt8189_afe_disable_reg_rw_clk(afe);
+
+ return ret;
}
static int mt8189_afe_component_probe(struct snd_soc_component *component)
--
2.43.0