Commit ed43d098 authored by Colin Ian King's avatar Colin Ian King Committed by Bjorn Andersson

rpmsg: glink: initialize ret to zero to ensure error status check is correct

The new switch cases for RPM_CMD_RX_DONE, RPM_CMD_RX_DONE_W_REUSE,
RPM_CMD_RX_INTENT_REQ_ACK, RPM_CMD_INTENT and RPM_CMD_RX_INTENT_REQ from
4 recent commits are not setting ret and so a later non-zero check on ret
is testing on a garbage value in ret. Fix this by initializing ret to zero.

Detected by CoverityScan CID#1455249 ("Uninitialized scalar variable")

Fixes: 933b45da ("rpmsg: glink: Add support for TX intents)
Fixes: dacbb35e ("glink: Receive and store the remote intent buffers")
Fixes: 27b9c5b6 ("rpmsg: glink: Request for intents when unavailable")
Fixes: 88c6060f ("rpmsg: glink: Handle remote rx done command")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 906cf29c
...@@ -957,7 +957,7 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data) ...@@ -957,7 +957,7 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data)
unsigned int param2; unsigned int param2;
unsigned int avail; unsigned int avail;
unsigned int cmd; unsigned int cmd;
int ret; int ret = 0;
for (;;) { for (;;) {
avail = qcom_glink_rx_avail(glink); avail = qcom_glink_rx_avail(glink);
...@@ -994,8 +994,6 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data) ...@@ -994,8 +994,6 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data)
mbox_send_message(glink->mbox_chan, NULL); mbox_send_message(glink->mbox_chan, NULL);
mbox_client_txdone(glink->mbox_chan, 0); mbox_client_txdone(glink->mbox_chan, 0);
ret = 0;
break; break;
case RPM_CMD_INTENT: case RPM_CMD_INTENT:
qcom_glink_handle_intent(glink, param1, param2, avail); qcom_glink_handle_intent(glink, param1, param2, avail);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment