diff mbox series

[3/3] ASoC: SOF: ipc3-dtrace: Return from dtrace_read if there is no new data available

Message ID 20220610080119.30880-4-peter.ujfalusi@linux.intel.com
State Accepted
Commit 1e90de2c9a40d7d0af5c7b0a6e2d362ffba94772
Headers show
Series ASoC: SOF: ipc3-dtrace: Handle race during initialization | expand

Commit Message

Peter Ujfalusi June 10, 2022, 8:01 a.m. UTC
If no new trace data is available then return immediately, there is no
need to continue with the execution of the trace_read() function.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 sound/soc/sof/ipc3-dtrace.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/sof/ipc3-dtrace.c b/sound/soc/sof/ipc3-dtrace.c
index 1f4d7a98c8fc..f59931d818c1 100644
--- a/sound/soc/sof/ipc3-dtrace.c
+++ b/sound/soc/sof/ipc3-dtrace.c
@@ -353,6 +353,10 @@  static ssize_t dfsentry_dtrace_read(struct file *file, char __user *buffer,
 		return -EIO;
 	}
 
+	/* no new trace data */
+	if (!avail)
+		return 0;
+
 	/* make sure count is <= avail */
 	if (count > avail)
 		count = avail;