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

Commit b43f4320 authored by Jeff Hugo's avatar Jeff Hugo
Browse files

soc: qcom: glink_smem_native_xprt: RPM fifo corrections



The pointer arithmetic for calculating the start of a RPM fifo was
incorrect.  Correct the math to get the right answer.  Also the spec has
clarified that the indicated fifo size includes the read/write indexes, so
adjust the fifo size accordingly.

Change-Id: If6e44f55f414fa91c2d3c95e2d754503272aa21c
Signed-off-by: default avatarJeffrey Hugo <jhugo@codeaurora.org>
parent e3a543d6
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1989,7 +1989,7 @@ static int glink_rpm_native_probe(struct platform_device *pdev)
		}
		++tocp;
		einfo->tx_ch_desc = msgram + *tocp;
		einfo->tx_fifo = einfo->tx_ch_desc + sizeof(*einfo->tx_ch_desc);
		einfo->tx_fifo = einfo->tx_ch_desc + 1;
		if ((uintptr_t)einfo->tx_fifo >
				(uintptr_t)(msgram + resource_size(msgram_r))) {
			pr_err("%s: invalid tx fifo address\n", __func__);
@@ -1997,7 +1997,7 @@ static int glink_rpm_native_probe(struct platform_device *pdev)
			break;
		}
		++tocp;
		einfo->tx_fifo_size = *tocp;
		einfo->tx_fifo_size = *tocp - sizeof(*einfo->tx_ch_desc);
		if (einfo->tx_fifo_size > resource_size(msgram_r) ||
			(uintptr_t)(einfo->tx_fifo + einfo->tx_fifo_size) >
				(uintptr_t)(msgram + resource_size(msgram_r))) {
@@ -2022,7 +2022,7 @@ static int glink_rpm_native_probe(struct platform_device *pdev)
		}
		++tocp;
		einfo->rx_ch_desc = msgram + *tocp;
		einfo->rx_fifo = einfo->rx_ch_desc + sizeof(*einfo->rx_ch_desc);
		einfo->rx_fifo = einfo->rx_ch_desc + 1;
		if ((uintptr_t)einfo->rx_fifo >
				(uintptr_t)(msgram + resource_size(msgram_r))) {
			pr_err("%s: invalid rx fifo address\n", __func__);
@@ -2030,7 +2030,7 @@ static int glink_rpm_native_probe(struct platform_device *pdev)
			break;
		}
		++tocp;
		einfo->rx_fifo_size = *tocp;
		einfo->rx_fifo_size = *tocp - sizeof(*einfo->rx_ch_desc);
		if (einfo->rx_fifo_size > resource_size(msgram_r) ||
			(uintptr_t)(einfo->rx_fifo + einfo->rx_fifo_size) >
				(uintptr_t)(msgram + resource_size(msgram_r))) {