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

Commit 86c5f5a7 authored by Hardik Arya's avatar Hardik Arya
Browse files

soc: qcom: glink: Return error in case of invalid input



In case of invalid input, fifo_read() function is returning
success instead of error. The patch returns error properly in
case of invalid input.

Change-Id: I6e3903381ef7ec8d0dd536623d10213460d0ae8e
Signed-off-by: default avatarHardik Arya <harya@codeaurora.org>
parent 0d7be4ee
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -483,8 +483,10 @@ static int fifo_read(struct edge_info *einfo, void *_data, int len)
	uint32_t fifo_size = einfo->rx_fifo_size;
	uint32_t n;

	if (read_index >= fifo_size || write_index >= fifo_size)
		return 0;
	if (read_index >= fifo_size || write_index >= fifo_size) {
		WARN_ON_ONCE(1);
		return -EINVAL;
	}
	while (len) {
		ptr = einfo->rx_fifo + read_index;
		if (read_index <= write_index)
@@ -531,8 +533,10 @@ static int fifo_write_body(struct edge_info *einfo, const void *_data,
	uint32_t fifo_size = einfo->tx_fifo_size;
	uint32_t n;

	if (read_index >= fifo_size || *write_index >= fifo_size)
		return 0;
	if (read_index >= fifo_size || *write_index >= fifo_size) {
		WARN_ON_ONCE(1);
		return -EINVAL;
	}
	while (len) {
		ptr = einfo->tx_fifo + *write_index;
		if (*write_index < read_index) {