Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
* [PATCH 2/2] USB: musb-gadget: fix DMA length for OUT transfer
@ 2010-08-27 14:52 tom.leiming
  2010-08-27 14:56 ` Gadiyar, Anand
  0 siblings, 1 reply; 2+ messages in thread
From: tom.leiming @ 2010-08-27 14:52 UTC (permalink / raw)
  To: greg, dbrownell, felipe.balbi
  Cc: linux-usb, linux-omap, Ming Lei, Anand Gadiyar, Mike Frysinger,
	Sergei Shtylyov

From: Ming Lei <tom.leiming@gmail.com>

DMA length should not go beyond the availabe space of request buffer,
so fix it.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Cc: Anand Gadiyar <gadiyar@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
---
 drivers/usb/musb/musb_gadget.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

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;
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-27 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-27 14:52 [PATCH 2/2] USB: musb-gadget: fix DMA length for OUT transfer tom.leiming
2010-08-27 14:56 ` Gadiyar, Anand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox