From patchwork Fri Aug 27 14:52:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 137891 X-Patchwork-Delegate: me@felipebalbi.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o7RErMmj026857 for ; Fri, 27 Aug 2010 14:53:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754355Ab0H0OxS (ORCPT ); Fri, 27 Aug 2010 10:53:18 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:56187 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754260Ab0H0OxQ (ORCPT ); Fri, 27 Aug 2010 10:53:16 -0400 Received: by pwi7 with SMTP id 7so1171333pwi.19 for ; Fri, 27 Aug 2010 07:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=lMbVA3S284DZt65kgGlLEUI9QhOJo13FzPhJRgVicxc=; b=XWh7/+kWimeDyfLgTgQwjmBmM+AW+eay8xmBKcRyQkx7K2FFycIrGqwQheSEOPWfTz 9PLJcEkG4mEKvcBY5mqV+J9udsisqoeCxXfy/cYplhnOqRDmkk5qj3VMlTv0tag7Gjrd 2mvGGRsdugbWBw28ucsUrzUSw8w7l971IeTqo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=cXbLoVAwkr5LLHwjTwbslX5GW9NQyWHomGA58GXa3Gl7Y3YmDOpwHXbtvKVcKesV2b nnJuafe6YYFaRrThwiTzaDTuu5rqNtrMyJPoD3JQK3YwiVtGMIwRI3EW/8Mc4cweUZxl 8Q3poQAwDYiZ4aHVnaoZbGop0lJLKS1bwQjOc= Received: by 10.142.231.7 with SMTP id d7mr1231267wfh.271.1282920796092; Fri, 27 Aug 2010 07:53:16 -0700 (PDT) Received: from localhost ([183.16.42.177]) by mx.google.com with ESMTPS id y16sm4531365wff.2.2010.08.27.07.52.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 27 Aug 2010 07:53:13 -0700 (PDT) From: tom.leiming@gmail.com To: greg@kroah.com, dbrownell@users.sourceforge.net, felipe.balbi@nokia.com Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, Ming Lei , Anand Gadiyar , Mike Frysinger , Sergei Shtylyov Subject: [PATCH 2/2] USB: musb-gadget: fix DMA length for OUT transfer Date: Fri, 27 Aug 2010 22:52:32 +0800 Message-Id: <1282920752-12490-1-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.6.2.5 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 27 Aug 2010 14:53:22 +0000 (UTC) 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;