msm: adsprpc: Allow zero length buffer

Initialize the arguments being passed to account for zero
length buffer being passed and not invoke flush routines
in these cases.

Change-Id: Ic8e095bdc59cb45c618897c6db5f512245d450dd
Acked-by: Sathish Ambley <sambley@qualcomm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
diff --git a/arch/arm/mach-msm/qdsp6v2/adsprpc.c b/arch/arm/mach-msm/qdsp6v2/adsprpc.c
index ea31769..822da91 100644
--- a/arch/arm/mach-msm/qdsp6v2/adsprpc.c
+++ b/arch/arm/mach-msm/qdsp6v2/adsprpc.c
@@ -189,6 +189,8 @@
 		void *buf;
 		int len, num;
 
+		list[i].num = 0;
+		list[i].pgidx = 0;
 		len = pra[i].buf.len;
 		if (!len)
 			continue;
@@ -250,6 +252,8 @@
 		int num;
 
 		rpra[i].buf.len = pra[i].buf.len;
+		if (!rpra[i].buf.len)
+			continue;
 		if (list[i].num) {
 			rpra[i].buf.pv = pra[i].buf.pv;
 			continue;
@@ -365,7 +369,7 @@
 	for (i = inbufs; i < inbufs + outbufs; ++i) {
 		if (buf_page_start(rpra) == buf_page_start(rpra[i].buf.pv))
 			inv = 1;
-		else
+		else if (rpra[i].buf.len)
 			dmac_inv_range(rpra[i].buf.pv,
 				(char *)rpra[i].buf.pv + rpra[i].buf.len);
 	}
@@ -600,7 +604,6 @@
 		goto bail;
  bail:
 	if (interrupted) {
-		init_completion(&ctx->work);
 		if (!kernel)
 			(void)fastrpc_release_current_dsp_process();
 		wait_for_completion(&ctx->work);