summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/soc/qcom/msm_glink_pkt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/soc/qcom/msm_glink_pkt.c b/drivers/soc/qcom/msm_glink_pkt.c
index 2a2d213f8ca0..ecc633749204 100644
--- a/drivers/soc/qcom/msm_glink_pkt.c
+++ b/drivers/soc/qcom/msm_glink_pkt.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -572,8 +572,10 @@ static void glink_pkt_notify_state_worker(struct work_struct *work)
mutex_lock(&devp->ch_lock);
devp->ch_state = event;
if (event == GLINK_CONNECTED) {
- if (!devp->handle)
- devp->handle = handle;
+ if (!devp->handle) {
+ GLINK_PKT_ERR("%s: Invalid device handle\n", __func__);
+ goto exit;
+ }
devp->in_reset = 0;
wake_up_interruptible(&devp->ch_opened_wait_queue);
} else if (event == GLINK_REMOTE_DISCONNECTED) {
@@ -585,6 +587,7 @@ static void glink_pkt_notify_state_worker(struct work_struct *work)
devp->handle = NULL;
wake_up_interruptible(&devp->ch_closed_wait_queue);
}
+exit:
mutex_unlock(&devp->ch_lock);
kfree(work_item);
}