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

Commit ec57adc3 authored by Lina Iyer's avatar Lina Iyer
Browse files

drivers: qcom: rpmh: Do not return on error while sending



It is possible that while sending multiples of requests using passthru
API. Do not return from the API, since some requests might have gone
through. We need to wait for them.

Clean up prior rpm_msg objects, if the request from pool fails.

Change-Id: I3ea43d3605f028e2653cd5a18bd3cc685cf14234
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent 56c0a94b
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -504,8 +504,12 @@ int rpmh_write_passthru(struct rpmh_client *rc, enum rpmh_state state,
	/* Create async request batches */
	for (i = 0; i < count; i++) {
		rpm_msg[i] = __get_rpmh_msg_async(rc, state, cmd, n[i]);
		if (IS_ERR_OR_NULL(rpm_msg[i]))
		if (IS_ERR_OR_NULL(rpm_msg[i])) {
			/* Clean up our call by spoofing tx_done */
			for (j = 0 ; j < i; j++)
				rpmh_tx_done(&rc->client, &rpm_msg[j]->msg, 0);
			return PTR_ERR(rpm_msg[i]);
		}
		cmd += n[i];
	}

@@ -518,10 +522,13 @@ int rpmh_write_passthru(struct rpmh_client *rc, enum rpmh_state state,
			rpm_msg[i]->wait_count = &wait_count;
			/* Bypass caching and write to mailbox directly */
			ret = mbox_send_message(rc->chan, &rpm_msg[i]->msg);
			if (ret < 0)
				return ret;
			if (ret < 0) {
				pr_err("Error(%d) sending RPM message addr=0x%x\n",
					ret, rpm_msg[i]->msg.payload[0].addr);
				break;
			}
		wait_event(waitq, atomic_read(&wait_count) == 0);
		}
		wait_event(waitq, atomic_read(&wait_count) == (count - i));
	} else {
		/* Send Sleep requests to the controller, expect no response */
		for (i = 0; i < count; i++) {