Skip to content

Commit b79934a

Browse files
committed
ASoC: SOF: 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 6a95ae1 commit b79934a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

sound/soc/sof/trace.c

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

311-
if (count > buffer_size - lpos) /* min() not used to avoid sparse warnings */
312-
count = buffer_size - lpos;
313-
314311
/* get available count based on current host offset */
315312
avail = sof_wait_trace_avail(sdev, lpos, buffer_size);
316313
if (sdev->dtrace_error) {
@@ -319,7 +316,8 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
319316
}
320317

321318
/* make sure count is <= avail */
322-
count = avail > count ? count : avail;
319+
if (count > avail)
320+
count = avail;
323321

324322
/* copy available trace data to debugfs */
325323
rem = copy_to_user(buffer, ((u8 *)(dfse->buf) + lpos), count);

0 commit comments

Comments
 (0)