summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorAmir Samuelov <amirs@codeaurora.org>2017-05-18 16:10:01 +0300
committerGerrit - the friendly Code Review server <code-review@localhost>2017-05-20 23:44:11 -0700
commit4f7c1784fa1452299d7bfec2b758c905ccdd18c5 (patch)
tree0ffff276a87c5a2cd667c5e8415b0ab728cbf552 /drivers/soc
parent60be71604a84d2e047215cb702d6324379a353bb (diff)
spcom: increment channel reference count after successful glink_open()
spcom_open() should increment the ref count only after successful glink open the channel. Otherwise, the following attempts to open the channel will fail. glink_open() failure was noticed after SP reset (SSR), when attempting to open the channel before the link between SP and HLOS is up. Change-Id: I8be28ce810f54cc3fa95d14c7244921acf7edaa7 Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/qcom/spcom.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/soc/qcom/spcom.c b/drivers/soc/qcom/spcom.c
index c2af34926b37..f406292a6c4d 100644
--- a/drivers/soc/qcom/spcom.c
+++ b/drivers/soc/qcom/spcom.c
@@ -721,9 +721,6 @@ static int spcom_open(struct spcom_channel *ch, unsigned int timeout_msec)
pr_err("channel [%s] already in use.\n", name);
goto exit_err;
}
- ch->ref_count++;
- ch->pid = current_pid();
- ch->txn_id = INITIAL_TXN_ID;
pr_debug("ch [%s] opened by PID [%d], count [%d]\n",
name, ch->pid, ch->ref_count);
@@ -748,7 +745,12 @@ static int spcom_open(struct spcom_channel *ch, unsigned int timeout_msec)
} else {
pr_debug("glink_open [%s] ok.\n", name);
}
+
+ /* init channel context after successful open */
ch->glink_handle = handle;
+ ch->ref_count++;
+ ch->pid = current_pid();
+ ch->txn_id = INITIAL_TXN_ID;
pr_debug("Wait for connection on channel [%s] timeout_msec [%d].\n",
name, timeout_msec);