From d1942a26d8db64b9a3c88946d223352e5f169175 Mon Sep 17 00:00:00 2001 From: Meng Wang Date: Tue, 27 Feb 2018 11:16:32 +0800 Subject: [PATCH] dsp: add null check for temp handle Variable mem_state in audio client(ac) is set to zero when there is a successful memory mapping. However the same variable is updated for various mapping commands. Ensure to check for both memstate and specific mem_handle to be updated in the wait condition to wake up the right waiting command. Change-Id: Iabba61cef0a90f636de50e9d27eecf886dc59a27 Signed-off-by: Meng Wang --- dsp/q6asm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsp/q6asm.c b/dsp/q6asm.c index 0569d1572bec..3098152d9898 100644 --- a/dsp/q6asm.c +++ b/dsp/q6asm.c @@ -7503,8 +7503,8 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, } rc = wait_event_timeout(ac->mem_wait, - (atomic_read(&ac->mem_state) >= 0) - , 5*HZ); + (atomic_read(&ac->mem_state) >= 0 && + ac->port[dir].tmp_hdl), 5*HZ); if (!rc) { pr_err("%s: timeout. waited for memory_map\n", __func__); rc = -ETIMEDOUT;