diff mbox

[1/2] rpmsg: glink: Unlock on error in qcom_glink_request_intent()

Message ID 20170908103345.brf5wcj5yg6zpslz@mwanda (mailing list archive)
State Accepted
Headers show

Commit Message

Dan Carpenter Sept. 8, 2017, 10:33 a.m. UTC
If qcom_glink_tx() fails, then we need to unlock before returning the
error code.

Fixes: 27b9c5b66b23 ("rpmsg: glink: Request for intents when unavailable")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sricharan Ramabadhran Sept. 8, 2017, 11:13 a.m. UTC | #1
Hi,

On 9/8/2017 4:03 PM, Dan Carpenter wrote:
> If qcom_glink_tx() fails, then we need to unlock before returning the
> error code.
> 
> Fixes: 27b9c5b66b23 ("rpmsg: glink: Request for intents when unavailable")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
> index 5a5e927ea50f..fecb1dafa8f3 100644
> --- a/drivers/rpmsg/qcom_glink_native.c
> +++ b/drivers/rpmsg/qcom_glink_native.c
> @@ -1197,7 +1197,7 @@ static int qcom_glink_request_intent(struct qcom_glink *glink,
>  
>  	ret = qcom_glink_tx(glink, &cmd, sizeof(cmd), NULL, 0, true);
>  	if (ret)
> -		return ret;
> +		goto unlock;
>  
>  	ret = wait_for_completion_timeout(&channel->intent_req_comp, 10 * HZ);
>  	if (!ret) {
> @@ -1207,6 +1207,7 @@ static int qcom_glink_request_intent(struct qcom_glink *glink,
>  		ret = channel->intent_req_result ? 0 : -ECANCELED;
>  	}
>  
> +unlock:

Thanks for the catch.

Acked-by: Sricharan R <sricharan@codeaurora.org>

Regards,
 Sricharan
diff mbox

Patch

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 5a5e927ea50f..fecb1dafa8f3 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1197,7 +1197,7 @@  static int qcom_glink_request_intent(struct qcom_glink *glink,
 
 	ret = qcom_glink_tx(glink, &cmd, sizeof(cmd), NULL, 0, true);
 	if (ret)
-		return ret;
+		goto unlock;
 
 	ret = wait_for_completion_timeout(&channel->intent_req_comp, 10 * HZ);
 	if (!ret) {
@@ -1207,6 +1207,7 @@  static int qcom_glink_request_intent(struct qcom_glink *glink,
 		ret = channel->intent_req_result ? 0 : -ECANCELED;
 	}
 
+unlock:
 	mutex_unlock(&channel->intent_req_lock);
 	return ret;
 }