avoid reading fifo rxcount is zero of fifo is empty, hence
read fifo only if rxcount is non-zero

Signed-off-by: Ravi Babu <ravib...@ti.com>
---
 drivers/usb/musb/musb_gadget_ep0.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget_ep0.c 
b/drivers/usb/musb/musb_gadget_ep0.c
index c9c1ac4..2af45a0 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -505,8 +505,10 @@ static void ep0_rxstate(struct musb *musb)
                        req->status = -EOVERFLOW;
                        count = len;
                }
-               musb_read_fifo(&musb->endpoints[0], count, buf);
-               req->actual += count;
+               if (count > 0) {
+                       musb_read_fifo(&musb->endpoints[0], count, buf);
+                       req->actual += count;
+               }
                csr = MUSB_CSR0_P_SVDRXPKTRDY;
                if (count < 64 || req->actual == req->length) {
                        musb->ep0_state = MUSB_EP0_STAGE_STATUSIN;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to