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 <mwang@codeaurora.org>
diff --git a/dsp/q6asm.c b/dsp/q6asm.c
index 7fe586f..5c57bfa 100644
--- a/dsp/q6asm.c
+++ b/dsp/q6asm.c
@@ -7257,8 +7257,8 @@
 	}
 
 	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;