aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2016-05-03 11:34:01 -0600
committerMathieu Poirier <mathieu.poirier@linaro.org>2016-06-01 15:46:44 -0600
commit4a192f60855a84820d361ec58eda0d043faab6f6 (patch)
tree96b6c286585ee79facdffd435fbbdf6fe746568a
parent6d1fcd0f0e7b17b4c9e4eaf0a61072b467110692 (diff)
downloadcoresight-v4.4-backport-jun.tar.gz
coresight: etb10: adjust read pointer only when neededv4.4-backport-jun
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)
-rw-r--r--drivers/hwtracing/coresight/coresight-etb10.c3
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,
read_ptr = (write_ptr + drvdata->buffer_depth) -
to_read / ETB_FRAME_SIZE_WORDS;
/* Wrap around if need be*/
- read_ptr &= ~(drvdata->buffer_depth - 1);
+ if (read_ptr > (drvdata->buffer_depth - 1))
+ read_ptr -= drvdata->buffer_depth;
/* let the decoder know we've skipped ahead */
local_inc(&buf->lost);
}