Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bedffda8 authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Greg Kroah-Hartman
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: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dc2c4ef1
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -428,7 +428,8 @@ static void etb_update_buffer(struct coresight_device *csdev,
		read_ptr = (write_ptr + drvdata->buffer_depth) -
		read_ptr = (write_ptr + drvdata->buffer_depth) -
					to_read / ETB_FRAME_SIZE_WORDS;
					to_read / ETB_FRAME_SIZE_WORDS;
		/* Wrap around if need be*/
		/* 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 */
		/* let the decoder know we've skipped ahead */
		local_inc(&buf->lost);
		local_inc(&buf->lost);
	}
	}