diff options
author | Ming Lei <tom.leiming@gmail.com> | 2010-09-20 03:32:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-09-24 14:05:01 -0400 |
commit | 1018b4e44f4f191c6e3c631c4eee35d0a112d32b (patch) | |
tree | f59207633a930fc265772264634117da6f16c764 /drivers/usb/musb | |
parent | 490e5fbe8ccb198fb719ae49eaa0c7071273e016 (diff) |
usb: musb: gadget: fix DMA length for OUT transfer
DMA length should not go beyond the availabe space of request buffer,
so fix it.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Anand Gadiyar <gadiyar@ti.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Anand Gadiyar <gadiyar@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | 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 176e1276dc28..f3ee04f2e17d 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -659,10 +659,11 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
659 | if (request->actual < request->length) { | 659 | if (request->actual < request->length) { |
660 | int transfer_size = 0; | 660 | int transfer_size = 0; |
661 | #ifdef USE_MODE1 | 661 | #ifdef USE_MODE1 |
662 | transfer_size = min(request->length, | 662 | transfer_size = min(request->length - request->actual, |
663 | channel->max_len); | 663 | channel->max_len); |
664 | #else | 664 | #else |
665 | transfer_size = len; | 665 | transfer_size = min(request->length - request->actual, |
666 | (unsigned)len); | ||
666 | #endif | 667 | #endif |
667 | if (transfer_size <= musb_ep->packet_sz) | 668 | if (transfer_size <= musb_ep->packet_sz) |
668 | musb_ep->dma->desired_mode = 0; | 669 | musb_ep->dma->desired_mode = 0; |