diff options
author | Mathieu Poirier <mathieu.poirier@linaro.org> | 2016-05-03 13:34:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-05-03 17:59:30 -0400 |
commit | bedffda8cad46bedb6880bb98c23c51c715216c3 (patch) | |
tree | e6dad6cf6f481ba494337240cb05e183148aea02 | |
parent | dc2c4ef141c5c14cb8d968ba16c74b4f3c373e2c (diff) |
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>
-rw-r--r-- | drivers/hwtracing/coresight/coresight-etb10.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 92f942321e1e..4d20b0be0c0b 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c | |||
@@ -428,7 +428,8 @@ static void etb_update_buffer(struct coresight_device *csdev, | |||
428 | read_ptr = (write_ptr + drvdata->buffer_depth) - | 428 | read_ptr = (write_ptr + drvdata->buffer_depth) - |
429 | to_read / ETB_FRAME_SIZE_WORDS; | 429 | to_read / ETB_FRAME_SIZE_WORDS; |
430 | /* Wrap around if need be*/ | 430 | /* 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; | ||
432 | /* let the decoder know we've skipped ahead */ | 433 | /* let the decoder know we've skipped ahead */ |
433 | local_inc(&buf->lost); | 434 | local_inc(&buf->lost); |
434 | } | 435 | } |