Merge "soc: qcom: glink_pkt: Exit if device handle is NULL"

This commit is contained in:
Linux Build Service Account 2018-01-09 15:40:24 -08:00 committed by Gerrit - the friendly Code Review server
commit 57f58180d9

View file

@ -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);
}