Skip to content

Commit 4a192f6

Browse files
coresight: etb10: adjust read pointer only when needed
The read pointer (read_ptr) needs to be adjusted only if its value has gone beyond the length of the memory buffer. Reported-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit bedffda8cad46bedb6880bb98c23c51c715216c3)
1 parent 6d1fcd0 commit 4a192f6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/hwtracing/coresight/coresight-etb10.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ static void etb_update_buffer(struct coresight_device *csdev,
428428
read_ptr = (write_ptr + drvdata->buffer_depth) -
429429
to_read / ETB_FRAME_SIZE_WORDS;
430430
/* Wrap around if need be*/
431-
read_ptr &= ~(drvdata->buffer_depth - 1);
431+
if (read_ptr > (drvdata->buffer_depth - 1))
432+
read_ptr -= drvdata->buffer_depth;
432433
/* let the decoder know we've skipped ahead */
433434
local_inc(&buf->lost);
434435
}

0 commit comments

Comments
 (0)