summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-07-10 06:32:03 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2014-07-10 06:32:02 -0700
commit5418ac5243fccc64cea236e396c1d9b7b13900cc (patch)
treee417004019ed095cda66975607da6f6ab412efee /sound/soc
parentc3f737d59e2b32c4daba79b09887ae0f1a140146 (diff)
parent3abb2fac4925b7402d22ff0f2222b12c7aaec5dc (diff)
Merge "ASoC: q6asm: Fix the memory leak during the SSR"
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/msm/qdsp6v2/q6asm.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sound/soc/msm/qdsp6v2/q6asm.c b/sound/soc/msm/qdsp6v2/q6asm.c
index 745b4c1d6945..9397b103c69d 100644
--- a/sound/soc/msm/qdsp6v2/q6asm.c
+++ b/sound/soc/msm/qdsp6v2/q6asm.c
@@ -680,7 +680,7 @@ int q6asm_audio_client_buf_free(unsigned int dir,
while (cnt >= 0) {
if (port->buf[cnt].data) {
- if (!rc)
+ if (!rc || atomic_read(&ac->reset))
msm_audio_ion_free(
port->buf[cnt].client,
port->buf[cnt].handle);
@@ -730,7 +730,7 @@ int q6asm_audio_client_buf_free_contiguous(unsigned int dir,
(void *)&port->buf[0].phys,
(void *)port->buf[0].client,
(void *)port->buf[0].handle);
- if (!rc)
+ if (!rc || atomic_read(&ac->reset))
msm_audio_ion_free(port->buf[0].client,
port->buf[0].handle);
port->buf[0].client = NULL;
@@ -890,6 +890,7 @@ struct audio_client *q6asm_audio_client_alloc(app_cb cb, void *priv)
init_waitqueue_head(&ac->cmd_wait);
init_waitqueue_head(&ac->time_wait);
atomic_set(&ac->time_flag, 1);
+ atomic_set(&ac->reset, 0);
INIT_LIST_HEAD(&ac->port[0].mem_map_handle);
INIT_LIST_HEAD(&ac->port[1].mem_map_handle);
pr_debug("%s: mem_map_handle list init'ed\n", __func__);
@@ -1301,22 +1302,20 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv)
}
if (data->opcode == RESET_EVENTS) {
+ atomic_set(&ac->reset, 1);
if (ac->apr == NULL)
ac->apr = ac->apr2;
pr_debug("q6asm_callback: Reset event is received: %d %d apr[%p]\n",
data->reset_event, data->reset_proc, ac->apr);
- if (ac->cb)
- ac->cb(data->opcode, data->token,
- (uint32_t *)data->payload, ac->priv);
- apr_reset(ac->apr);
if (ac->cb)
ac->cb(data->opcode, data->token,
- data->payload, ac->priv);
+ (uint32_t *)data->payload, ac->priv);
+ apr_reset(ac->apr);
+ ac->apr = NULL;
atomic_set(&ac->time_flag, 0);
atomic_set(&ac->cmd_state, 0);
wake_up(&ac->time_wait);
wake_up(&ac->cmd_wait);
- ac->apr = NULL;
return 0;
}