Commit 1018b4e4 authored by Ming Lei's avatar Ming Lei Committed by Greg Kroah-Hartman

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: default avatarMing Lei <tom.leiming@gmail.com>
Acked-by: default avatarAnand 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: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 490e5fbe
...@@ -659,10 +659,11 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -659,10 +659,11 @@ static void rxstate(struct musb *musb, struct musb_request *req)
if (request->actual < request->length) { if (request->actual < request->length) {
int transfer_size = 0; int transfer_size = 0;
#ifdef USE_MODE1 #ifdef USE_MODE1
transfer_size = min(request->length, transfer_size = min(request->length - request->actual,
channel->max_len); channel->max_len);
#else #else
transfer_size = len; transfer_size = min(request->length - request->actual,
(unsigned)len);
#endif #endif
if (transfer_size <= musb_ep->packet_sz) if (transfer_size <= musb_ep->packet_sz)
musb_ep->dma->desired_mode = 0; musb_ep->dma->desired_mode = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment