Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a92e1a5 authored by Ramprasad Katkam's avatar Ramprasad Katkam Committed by Banajit Goswami
Browse files

ASoC: APR: Fix missing APR deregister from asm



APR deregister is to be called for two ports from both
q6asm_callback(during RESET) and q6asm_audio_client_free.
In race condition between the two, APR deregister is called
only for one port. The mismatch in apr register-deregister
count causes apr not to reset service after ssr, causing
APR communication failure.

Change-Id: Ibd0528215bf2fb986eda03ae0d683b2af31358fe
Signed-off-by: default avatarRamprasad Katkam <katkam@codeaurora.org>
parent 2dd03d12
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -746,13 +746,14 @@ int apr_deregister(void *handle)
	if (!handle)
		return -EINVAL;

	mutex_lock(&svc->m_lock);
	if (!svc->svc_cnt) {
		pr_err("%s: svc already deregistered. svc = %pK\n",
			__func__, svc);
		mutex_unlock(&svc->m_lock);
		return -EINVAL;
	}

	mutex_lock(&svc->m_lock);
	dest_id = svc->dest_id;
	client_id = svc->client_id;
	clnt = &client[dest_id][client_id];
+6 −8
Original line number Diff line number Diff line
@@ -1035,14 +1035,12 @@ void q6asm_audio_client_free(struct audio_client *ac)
	}

	rtac_set_asm_handle(ac->session, NULL);
	if (!atomic_read(&ac->reset)) {
	apr_deregister(ac->apr2);
	apr_deregister(ac->apr);
	q6asm_mmap_apr_dereg();
	ac->apr2 = NULL;
	ac->apr = NULL;
	ac->mmap_apr = NULL;
	}
	q6asm_session_free(ac);

	pr_debug("%s: APR De-Register\n", __func__);