]> git.baikalelectronics.ru Git - kernel.git/commitdiff
rpmsg: glink: Unlock on error in qcom_glink_request_intent()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 8 Sep 2017 10:33:45 +0000 (13:33 +0300)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Tue, 10 Oct 2017 18:22:09 +0000 (11:22 -0700)
If qcom_glink_tx() fails, then we need to unlock before returning the
error code.

Fixes: 27b9c5b66b23 ("rpmsg: glink: Request for intents when unavailable")
Acked-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/rpmsg/qcom_glink_native.c

index 5a5e927ea50f45ac307dc6ed0abfa4f8d4b3a815..fecb1dafa8f36f754b5333d01b05a641192532b0 100644 (file)
@@ -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;
 }