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

Commit e1149411 authored by Kyle Piefer's avatar Kyle Piefer
Browse files

msm: kgsl: Delete list entry in only one place



To prevent racing, only delete the pending message
from the list in the function that puts it in the list.
This prevents the handler from deleting it in another
thread.

CRs-Fixed: 2063062
Change-Id: Ied140ca1e76282f48c4f9b0fc7ca5f311ba6c67f
Signed-off-by: default avatarKyle Piefer <kpiefer@codeaurora.org>
parent 123357f5
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -185,11 +185,9 @@ static void receive_ack_msg(struct gmu_device *gmu, struct hfi_msg_rsp *rsp)
	spin_lock(&hfi->msglock);
	list_for_each_entry_safe(msg, next, &hfi->msglist, node) {
		if (msg->msg_id == rsp->ret_hdr.id &&
				msg->seqnum == rsp->ret_hdr.seqnum) {
			list_del(&msg->node);
				msg->seqnum == rsp->ret_hdr.seqnum)
			break;
	}
	}
	spin_unlock(&hfi->msglock);

	if (msg == NULL) {
@@ -235,7 +233,7 @@ static int hfi_send_msg(struct gmu_device *gmu, struct hfi_msg_hdr *msg,

	if (hfi_cmdq_write(gmu, HFI_CMD_QUEUE, msg) != size) {
		rc = -EINVAL;
		goto error;
		goto done;
	}

	rc = wait_for_completion_timeout(
@@ -245,11 +243,12 @@ static int hfi_send_msg(struct gmu_device *gmu, struct hfi_msg_hdr *msg,
		dev_err(&gmu->pdev->dev,
				"Receiving GMU ack %d timed out\n", msg->id);
		rc = -ETIMEDOUT;
		goto error;
		goto done;
	}

	return 0;
error:
	/* If we got here we succeeded */
	rc = 0;
done:
	spin_lock(&hfi->msglock);
	list_del(&ret_msg->node);
	spin_unlock(&hfi->msglock);