mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 15:11:48 -04:00
dsp: lsm: add apr NULL check in apr deregister
During SSR, q6lsm_mmapcallback could happen before q6lsm_mmap_apr_dereg. q6lsm_common.apr and q6lsm_common.apr_users are cleared in q6lsm_mmapcallback. Add apr NULL check in q6lsm_mmap_apr_dereg before accessing q6lsm_common.apr_users. Change-Id: Ia0ff57b3fff0a0e4f26b836a8a15324406af1a14 Signed-off-by: Meng Wang <mengw@codeaurora.org>
This commit is contained in:
parent
018a061578
commit
c893cd2e0d
1 changed files with 9 additions and 6 deletions
15
dsp/q6lsm.c
15
dsp/q6lsm.c
|
|
@ -285,12 +285,15 @@ static void *q6lsm_mmap_apr_reg(void)
|
|||
|
||||
static int q6lsm_mmap_apr_dereg(void)
|
||||
{
|
||||
if (atomic_read(&lsm_common.apr_users) <= 0) {
|
||||
WARN("%s: APR common port already closed\n", __func__);
|
||||
} else {
|
||||
if (atomic_dec_return(&lsm_common.apr_users) == 0) {
|
||||
apr_deregister(lsm_common.apr);
|
||||
pr_debug("%s: APR De-Register common port\n", __func__);
|
||||
if (lsm_common.apr) {
|
||||
if (atomic_read(&lsm_common.apr_users) <= 0) {
|
||||
WARN("%s: APR common port already closed\n", __func__);
|
||||
} else {
|
||||
if (atomic_dec_return(&lsm_common.apr_users) == 0) {
|
||||
apr_deregister(lsm_common.apr);
|
||||
pr_debug("%s: APR De-Register common port\n",
|
||||
__func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue