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

Commit 8f9cf4cd authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: q6asm: Fix the memory leak during the SSR"

parents 3d602005 4c74289c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -183,6 +183,7 @@ struct audio_client {
	/* audio cache operations fptr*/
	int (*fptr_cache_ops)(struct audio_buffer *abuff, int cache_op);
	atomic_t               unmap_cb_success;
	atomic_t               reset;
};

void q6asm_audio_client_free(struct audio_client *ac);
+7 −8
Original line number Diff line number Diff line
@@ -751,7 +751,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);
@@ -801,7 +801,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;
@@ -962,6 +962,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__);
@@ -1389,6 +1390,7 @@ 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",
@@ -1397,14 +1399,11 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv)
			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);
		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;
	}