diag: Avoid partial packet reads

DIAG driver talks to peripheral processors over SMD channels.
Sometimes, SMD channel can have a partial packet and if diag
reads it, it can mistake them as garbled packets. With this
change, if the packet is incomplete, diag will not read it
and wait until the packet is complete.

This approach will work, as long as, peripheral is sending packets
less than 1000 bytes. Currently even the peripheral is limited to
sending packets upto 1K bytes, so this limitation is fine.

Also fix potential memory allocation failure and unnecessary
reading from SMD channels.

Change-Id: I86e6aa202d1e1159e7b3f099cb1228530489a370
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
diff --git a/drivers/char/diag/diagfwd.c b/drivers/char/diag/diagfwd.c
index 5838bba..079e04b 100644
--- a/drivers/char/diag/diagfwd.c
+++ b/drivers/char/diag/diagfwd.c
@@ -1038,9 +1038,9 @@
 	queue_work(driver->diag_wq, &(driver->diag_read_smd_qdsp_work));
 	queue_work(driver->diag_wq, &(driver->diag_read_smd_wcnss_work));
 	/* Poll SMD CNTL channels to check for data */
-	queue_work(driver->diag_wq, &(driver->diag_read_smd_cntl_work));
-	queue_work(driver->diag_wq, &(driver->diag_read_smd_qdsp_cntl_work));
-	queue_work(driver->diag_wq, &(driver->diag_read_smd_wcnss_cntl_work));
+	diag_smd_cntl_notify(NULL, SMD_EVENT_DATA);
+	diag_smd_qdsp_cntl_notify(NULL, SMD_EVENT_DATA);
+	diag_smd_wcnss_cntl_notify(NULL, SMD_EVENT_DATA);
 	/* Poll USB channel to check for data*/
 	queue_work(driver->diag_wq, &(driver->diag_read_work));
 #ifdef CONFIG_DIAG_SDIO_PIPE