diff mbox

[2/2] USB: musb-gadget: fix DMA length for OUT transfer

Message ID 1282920752-12490-1-git-send-email-tom.leiming@gmail.com (mailing list archive)
State New, archived
Delegated to: Felipe Balbi
Headers show

Commit Message

Ming Lei Aug. 27, 2010, 2:52 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index c0dfec4..e898228 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -662,10 +662,11 @@  static void rxstate(struct musb *musb, struct musb_request *req)
 				if (request->actual < request->length) {
 					int transfer_size = 0;
 #ifdef USE_MODE1
-					transfer_size = min(request->length,
+					transfer_size = min(request->length - request->actual,
 							channel->max_len);
 #else
-					transfer_size = len;
+					transfer_size = min(request->length - request->actual,
+							len);
 #endif
 					if (transfer_size <= musb_ep->packet_sz)
 						musb_ep->dma->desired_mode = 0;