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

Commit 674b223d authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam Committed by Greg Kroah-Hartman
Browse files

rpmsg: glink: smem: Support rx peak for size less than 4 bytes



[ Upstream commit 928002a5e9dab2ddc1a0fe3e00739e89be30dc6b ]

The current rx peak function fails to read the data if size is
less than 4bytes.

Use memcpy_fromio to support data reads of size less than 4 bytes.

Cc: stable@vger.kernel.org
Fixes: f0beb4ba9b18 ("rpmsg: glink: Remove chunk size word align warning")
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ec9fc981
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -89,15 +89,11 @@ static void glink_smem_rx_peak(struct qcom_glink_pipe *np,
		tail -= pipe->native.length;

	len = min_t(size_t, count, pipe->native.length - tail);
	if (len) {
		__ioread32_copy(data, pipe->fifo + tail,
				len / sizeof(u32));
	}
	if (len)
		memcpy_fromio(data, pipe->fifo + tail, len);

	if (len != count) {
		__ioread32_copy(data + len, pipe->fifo,
				(count - len) / sizeof(u32));
	}
	if (len != count)
		memcpy_fromio(data + len, pipe->fifo, (count - len));
}

static void glink_smem_rx_advance(struct qcom_glink_pipe *np,