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>
This commit is contained in:
Amir Samuelov 2017-05-18 16:10:01 +03:00 committed by Gerrit - the friendly Code Review server
parent 60be71604a
commit 4f7c1784fa

View file

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