Skip to content

Commit 11529fc

Browse files
committed
ASoC: SOF: sof-client-dma-trace: Simplify count adjustment in trace_read
The first count check and fixup against "buffer - lpos" can be removed as we will do the adjustment later against the "avail" in sof_dfsentry_trace_read() Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 6d06b8c commit 11529fc

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

sound/soc/sof/sof-client-dma-trace.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,6 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
341341
lpos_64 = lpos;
342342
lpos = do_div(lpos_64, buffer_size);
343343

344-
if (count > buffer_size - lpos) /* min() not used to avoid sparse warnings */
345-
count = buffer_size - lpos;
346-
347344
/* get available count based on current host offset */
348345
avail = sof_wait_trace_avail(cdev, lpos, buffer_size);
349346
if (priv->dtrace_error) {
@@ -352,7 +349,8 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
352349
}
353350

354351
/* make sure count is <= avail */
355-
count = avail > count ? count : avail;
352+
if (count > avail)
353+
count = avail;
356354

357355
/* copy available trace data to debugfs */
358356
rem = copy_to_user(buffer, ((u8 *)(priv->dmatb.area) + lpos), count);

0 commit comments

Comments
 (0)