mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
dsp: lsm: Initialize lock and condition before apr_register
While allocating lsm client, lock and conditions are initialized after registering session with APR. There is a possibility of accessing uninitialized condition from q6lsm_callback when SSR is triggerred after the port specific apr is registered. Initialized lock, condition and state before registering session with APR to avoid invalid access. CRs-Fixed: 2230065 Change-Id: I48b6eb7670863c45b0539155592ea0b0a3c1bffc Signed-off-by: pavanc <pavanc@codeaurora.org>
This commit is contained in:
parent
e039f16fa4
commit
8a81c4a868
1 changed files with 5 additions and 3 deletions
|
|
@ -311,6 +311,11 @@ struct lsm_client *q6lsm_client_alloc(lsm_app_cb cb, void *priv)
|
|||
kfree(client);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
init_waitqueue_head(&client->cmd_wait);
|
||||
mutex_init(&client->cmd_lock);
|
||||
atomic_set(&client->cmd_state, CMD_STATE_CLEARED);
|
||||
|
||||
pr_debug("%s: Client Session %d\n", __func__, client->session);
|
||||
client->apr = apr_register("ADSP", "LSM", q6lsm_callback,
|
||||
((client->session) << 8 | client->session),
|
||||
|
|
@ -328,9 +333,6 @@ struct lsm_client *q6lsm_client_alloc(lsm_app_cb cb, void *priv)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
init_waitqueue_head(&client->cmd_wait);
|
||||
mutex_init(&client->cmd_lock);
|
||||
atomic_set(&client->cmd_state, CMD_STATE_CLEARED);
|
||||
pr_debug("%s: New client allocated\n", __func__);
|
||||
return client;
|
||||
fail:
|
||||
|
|
|
|||
Loading…
Reference in a new issue