Skip to content

Commit b269552

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 b3089af commit b269552

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
@@ -334,9 +334,6 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
334334
lpos_64 = lpos;
335335
lpos = do_div(lpos_64, buffer_size);
336336

337-
if (count > buffer_size - lpos) /* min() not used to avoid sparse warnings */
338-
count = buffer_size - lpos;
339-
340337
/* get available count based on current host offset */
341338
avail = sof_wait_trace_avail(cdev, lpos, buffer_size);
342339
if (priv->dtrace_error) {
@@ -345,7 +342,8 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
345342
}
346343

347344
/* make sure count is <= avail */
348-
count = avail > count ? count : avail;
345+
if (count > avail)
346+
count = avail;
349347

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

0 commit comments

Comments
 (0)