Added a check in musb_{read | write}_fifo for zero byte length.

Signed-off-by: Ajay Kumar Gupta <ajay.gu...@ti.com>
---
 drivers/usb/musb/musb_core.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index db3dff8..2901f38 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -234,6 +234,9 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, 
const u8 *src)
        struct musb *musb = hw_ep->musb;
        void __iomem *fifo = hw_ep->fifo;
 
+       if (unlikely(len == 0))
+               return;
+
        prefetch((u8 *)src);
 
        dev_dbg(musb->controller, "%cX ep%d fifo %p count %d buf %p\n",
@@ -276,6 +279,9 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 
*dst)
        struct musb *musb = hw_ep->musb;
        void __iomem *fifo = hw_ep->fifo;
 
+       if (unlikely(len == 0))
+               return;
+
        dev_dbg(musb->controller, "%cX ep%d fifo %p count %d buf %p\n",
                        'R', hw_ep->epnum, fifo, len, dst);
 
-- 
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