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

Commit 8147051b authored by Amir Samuelov's avatar Amir Samuelov Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: spcom: propagate response timeout error



HLOS client send request to SP server and expect response within timeout.
if timeout expires, return ETIMEDOUT error, rather than a general error.

Change-Id: Ic7691848ff133196bf31294c010e98846de2c470
Signed-off-by: default avatarAmir Samuelov <amirs@codeaurora.org>
parent 541fe938
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -886,10 +886,11 @@ static int spcom_rx(struct spcom_channel *ch,

	if (timeleft == 0) {
		pr_err("rx_done timeout [%d] msec expired.\n", timeout_msec);
		goto exit_err;
		mutex_unlock(&ch->lock);
		return -ETIMEDOUT;
	} else if (ch->rx_abort) {
		pr_err("rx aborted.\n");
		goto exit_err;
		mutex_unlock(&ch->lock);
		return -ERESTART; /* probably SSR */
	} else if (ch->actual_rx_size) {
		pr_debug("actual_rx_size is [%d].\n", ch->actual_rx_size);
	} else {
@@ -1976,7 +1977,8 @@ static int spcom_handle_read_req_resp(struct spcom_channel *ch,
	ret = spcom_rx(ch, rx_buf, rx_buf_size, timeout_msec);
	if (ret < 0) {
		pr_err("rx error %d.\n", ret);
		goto exit_err;
		kfree(rx_buf);
		return ret;
	} else {
		size = ret; /* actual_rx_size */
	}
@@ -2269,8 +2271,14 @@ static ssize_t spcom_device_read(struct file *filp, char __user *user_buff,
	if (buf == NULL)
		return -ENOMEM;

	actual_size = spcom_handle_read(ch, buf, size);
	if ((actual_size <= 0) || (actual_size > size)) {
	ret = spcom_handle_read(ch, buf, size);
	if (ret < 0) {
		pr_err("read error [%d].\n", ret);
		kfree(buf);
		return ret;
	}
	actual_size = ret;
	if ((actual_size == 0) || (actual_size > size)) {
		pr_err("invalid actual_size [%d].\n", actual_size);
		kfree(buf);
		return -EFAULT;