Skip to content

Commit

Permalink
usb: musb: gadget: read ep0 fifo only if rxcount is non zero
Browse files Browse the repository at this point in the history
avoid reading fifo rxcount is zero of fifo is empty, hence
read fifo only if rxcount is non-zero

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Ravi Babu authored and Felipe Balbi committed Apr 2, 2013
1 parent 96449f0 commit 538bf07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/usb/musb/musb_gadget_ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 538bf07

Please sign in to comment.