msm: rpm-smd: Remove BUG if packet size is 0
When a interrupt for data event is received, it is possible that the SMD
packet could have been processed on other core executing with interrupts
locked. In this case, the data event would have scheduled a workqueue
which would result in 0 bytes for packet size. This is a valid scenario
and shouldn't throw a bug.
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
(cherry picked from commit 137cd700c1524ee274118d5dd6055d3673a2e8f7)
Change-Id: I90efeaa814ebec82542e46c35df754a1f380251c
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
diff --git a/arch/arm/mach-msm/rpm-smd.c b/arch/arm/mach-msm/rpm-smd.c
index 7213f59..108a6a4 100644
--- a/arch/arm/mach-msm/rpm-smd.c
+++ b/arch/arm/mach-msm/rpm-smd.c
@@ -472,13 +472,14 @@
pkt_sz = smd_cur_packet_size(msm_rpm_data.ch_info);
+ if (!pkt_sz)
+ return -EAGAIN;
+
BUG_ON(pkt_sz > MAX_ERR_BUFFER_SIZE);
if (pkt_sz != smd_read_avail(msm_rpm_data.ch_info))
return -EAGAIN;
- BUG_ON(pkt_sz == 0);
-
do {
int len;