msm: pil: Unlock wakelock on proxy vote error path
If the proxy vote fails for some reason the wake lock will never
be released. Check the return value of the proxy vote and unlock
the wakelock if the proxy vote fails.
Change-Id: I0982896ab722bffed5f1c49247974dc84d5f3942
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/peripheral-loader.c b/arch/arm/mach-msm/peripheral-loader.c
index 16c21f7..3f6eb95 100644
--- a/arch/arm/mach-msm/peripheral-loader.c
+++ b/arch/arm/mach-msm/peripheral-loader.c
@@ -114,11 +114,15 @@
static int pil_proxy_vote(struct pil_device *pil)
{
+ int ret = 0;
+
if (pil->desc->ops->proxy_vote) {
wake_lock(&pil->wlock);
- return pil->desc->ops->proxy_vote(pil->desc);
+ ret = pil->desc->ops->proxy_vote(pil->desc);
+ if (ret)
+ wake_unlock(&pil->wlock);
}
- return 0;
+ return ret;
}
static void pil_proxy_unvote(struct pil_device *pil, unsigned long timeout)