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>
This commit is contained in:
parent
490e5fbe8c
commit
1018b4e44f
|
@ -659,10 +659,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,
|
||||
(unsigned)len);
|
||||
#endif
|
||||
if (transfer_size <= musb_ep->packet_sz)
|
||||
musb_ep->dma->desired_mode = 0;
|
||||
|
|
Loading…
Reference in New Issue