[PATCH v2 17/25] ASoC: codecs: wm8782: Ensure the DAI is marked as started on success
phucduc.bui at gmail.com
phucduc.bui at gmail.com
Wed Oct 14 18:43:16 PDT 2026
From: bui duc phuc <phucduc.bui at gmail.com>
snd_pcm_hw_constraint_minmax() may return 1, which is then returned
from wm8782_dai_startup(). ASoC only marks the DAI as started when
.startup() returns 0.
This currently has no functional impact, as wm8782_dai_ops has no
.shutdown() callback. Still, return 0 explicitly on success to
match what ASoC expects and ensure the DAI is correctly marked as
started.
Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
---
sound/soc/codecs/wm8782.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wm8782.c b/sound/soc/codecs/wm8782.c
index 3a2acdfa9b85..cbf0c823c022 100644
--- a/sound/soc/codecs/wm8782.c
+++ b/sound/soc/codecs/wm8782.c
@@ -39,9 +39,19 @@ static int wm8782_dai_startup(struct snd_pcm_substream *sub, struct snd_soc_dai
struct snd_pcm_runtime *runtime = sub->runtime;
struct wm8782_priv *priv =
snd_soc_component_get_drvdata(dai->component);
+ int ret;
- return snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
+ ret = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
8000, priv->max_rate);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * ASoC only marks the DAI as started when .startup() returns 0.
+ * Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
+ * return 0 to ensure the DAI is correctly marked as started.
+ */
+ return 0;
}
static const struct snd_soc_dapm_widget wm8782_dapm_widgets[] = {
--
2.43.0
More information about the Linux-rockchip
mailing list