From: bui duc phuc <[email protected]>

snd_pcm_hw_constraint_integer() may return 1, which is then returned
from rz_ssi_pcm_open_pio(). ASoC only marks the component as opened when
.open() returns 0.

This currently has no functional impact, as the component driver has no
.close() callback. Still, return 0 explicitly on success to match what
ASoC expects and ensure the component is correctly marked as opened.

Signed-off-by: bui duc phuc <[email protected]>
---
 sound/soc/renesas/rz-ssi.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/sound/soc/renesas/rz-ssi.c b/sound/soc/renesas/rz-ssi.c
index b1587f499cb8..5f4a53886541 100644
--- a/sound/soc/renesas/rz-ssi.c
+++ b/sound/soc/renesas/rz-ssi.c
@@ -937,10 +937,21 @@ static const struct snd_pcm_hardware rz_ssi_pcm_hardware 
= {
 static int rz_ssi_pcm_open_pio(struct snd_soc_component *component,
                               struct snd_pcm_substream *substream)
 {
+       int ret;
+
        snd_soc_set_runtime_hwparams(substream, &rz_ssi_pcm_hardware);
 
-       return snd_pcm_hw_constraint_integer(substream->runtime,
+       ret = snd_pcm_hw_constraint_integer(substream->runtime,
                                            SNDRV_PCM_HW_PARAM_PERIODS);
+       if (ret < 0)
+               return ret;
+
+       /*
+        * ASoC only marks the component as opened when .open() returns 0.
+        * Since snd_pcm_hw_constraint_integer() may return 1, explicitly
+        * return 0 to ensure the component is correctly marked as opened.
+        */
+       return 0;
 }
 
 static int rz_ssi_pcm_open_dma(struct snd_soc_component *component,
-- 
2.43.0


Reply via email to