diff mbox series

ASoC: SOF: Intel: Add error handling in hda_dsp_trace_release

Message ID 20230923091216.26325-1-liuhaoran14@163.com
State New
Headers show
Series ASoC: SOF: Intel: Add error handling in hda_dsp_trace_release | expand

Commit Message

Haoran Liu Sept. 23, 2023, 9:12 a.m. UTC
This patch adds error-handling for the hda_dsp_stream_put() inside
the hda_dsp_trace_release function in the hda-trace.c file.

Signed-off-by: liuhaoran <liuhaoran14@163.com>
---
 sound/soc/sof/intel/hda-trace.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Pierre-Louis Bossart Oct. 3, 2023, 3:13 p.m. UTC | #1
On 9/23/23 05:12, liuhaoran wrote:
> This patch adds error-handling for the hda_dsp_stream_put() inside
> the hda_dsp_trace_release function in the hda-trace.c file.
> 
> Signed-off-by: liuhaoran <liuhaoran14@163.com>
> ---
>  sound/soc/sof/intel/hda-trace.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sof/intel/hda-trace.c b/sound/soc/sof/intel/hda-trace.c
> index cbb9bd7770e6..5dcd43b9cbe4 100644
> --- a/sound/soc/sof/intel/hda-trace.c
> +++ b/sound/soc/sof/intel/hda-trace.c
> @@ -73,13 +73,22 @@ int hda_dsp_trace_release(struct snd_sof_dev *sdev)
>  {
>  	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
>  	struct hdac_stream *hstream;
> +	int ret;
>  
>  	if (hda->dtrace_stream) {
>  		hstream = &hda->dtrace_stream->hstream;
> -		hda_dsp_stream_put(sdev,
> +		ret = hda_dsp_stream_put(sdev,
>  				   SNDRV_PCM_STREAM_CAPTURE,
>  				   hstream->stream_tag);
> +
>  		hda->dtrace_stream = NULL;
> +
> +		if (ret < 0) {
> +			dev_dbg(sdev->dev,
> +				"stream put failed: %d\n", ret);
> +			return ret;
> +		}
> +

I don't know if returning an error helps here, this might get in the way
of the suspend.

Peter, what do you think?


>  		return 0;
>  	}
>
diff mbox series

Patch

diff --git a/sound/soc/sof/intel/hda-trace.c b/sound/soc/sof/intel/hda-trace.c
index cbb9bd7770e6..5dcd43b9cbe4 100644
--- a/sound/soc/sof/intel/hda-trace.c
+++ b/sound/soc/sof/intel/hda-trace.c
@@ -73,13 +73,22 @@  int hda_dsp_trace_release(struct snd_sof_dev *sdev)
 {
 	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
 	struct hdac_stream *hstream;
+	int ret;
 
 	if (hda->dtrace_stream) {
 		hstream = &hda->dtrace_stream->hstream;
-		hda_dsp_stream_put(sdev,
+		ret = hda_dsp_stream_put(sdev,
 				   SNDRV_PCM_STREAM_CAPTURE,
 				   hstream->stream_tag);
+
 		hda->dtrace_stream = NULL;
+
+		if (ret < 0) {
+			dev_dbg(sdev->dev,
+				"stream put failed: %d\n", ret);
+			return ret;
+		}
+
 		return 0;
 	}