[PATCH 4/4] ASoC: codecs: wm8994: Handle hw_params return value
From: phucduc . bui
Date: Fri Oct 23 2026 - 05:06:45 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
snd_soc_component_update_bits() may return 1 when the register value
changes, but ASoC only marks the DAI hw_params as done when .hw_params()
returns 0.
Propagate negative errors and return 0 on success.
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/codecs/wm8994.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index c65a7769a9d2..6cda0aa4c3be 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3093,6 +3093,7 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
struct wm8994 *control = wm8994->wm8994;
int aif1_reg;
int aif1 = 0;
+ int ret;
switch (dai->id) {
case 3:
@@ -3125,7 +3126,16 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- return snd_soc_component_update_bits(component, aif1_reg, WM8994_AIF1_WL_MASK, aif1);
+ ret = snd_soc_component_update_bits(component, aif1_reg, WM8994_AIF1_WL_MASK, aif1);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * ASoC only marks the DAI hw_params as done when .hw_params() returns 0.
+ * Since snd_soc_component_update_bits() may return 1, explicitly
+ * return 0 to ensure the DAI is correctly marked.
+ */
+ return 0;
}
static int wm8994_aif_mute(struct snd_soc_dai *codec_dai, int mute,
--
2.43.0