From patchwork Tue Sep 7 15:23: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: 161381 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 o87FPH9k004056 for ; Tue, 7 Sep 2010 15:25:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757503Ab0IGPZL (ORCPT ); Tue, 7 Sep 2010 11:25:11 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:39134 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757432Ab0IGPZK (ORCPT ); Tue, 7 Sep 2010 11:25:10 -0400 Received: by pvg2 with SMTP id 2so1787484pvg.19 for ; Tue, 07 Sep 2010 08:25:09 -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:in-reply-to:references; bh=kFFsl5lLgwg3gxD0CVr9h2diuxCtBknqJiAXflyZ2PQ=; b=VP2fjn7Q/mJZIWO+dbHVJTma+naNvgY9YXRF3ohRkSTRSYCxYeI+roauqY4XtCA/Zb 8vKgMttymJ8hK2coSZ0K4fddVC2x66AqymskF7sZJgw94dtKIgnJbaFNRmKYBZuTxu7v DCnxfXmJZoImofpn5FJrfpF7WaykTyVNcRrJ8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=L6BTOToS4QUR3jw9pH5sIAMxXQJTwJqPkfaAg4khwPzR6MfZmtevqVKwUjmku6szPl MCe5VvoHVyZbMkPX3iRcZFr7uynJg3B67rj/waRCG5S3Rj1Em2U/HWCZj08/1IsfsuZT 56MpDCSduK0Xe9M2bpNXdr/h808xRwtwtBP7Y= Received: by 10.114.15.11 with SMTP id 11mr14777wao.121.1283873104782; Tue, 07 Sep 2010 08:25:04 -0700 (PDT) Received: from localhost ([183.16.32.111]) by mx.google.com with ESMTPS id s5sm13709380wak.0.2010.09.07.08.24.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Sep 2010 08:25:03 -0700 (PDT) From: tom.leiming@gmail.com To: greg@kroah.com Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Ming Lei , David Brownell , Felipe Balbi , Anand Gadiyar , Mike Frysinger , Sergei Shtylyov Subject: [RESEND/PATCH 4/6] USB: musb-gadget: fix DMA length for OUT transfer Date: Tue, 7 Sep 2010 23:23:32 +0800 Message-Id: <1283873014-32511-5-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1283873014-32511-1-git-send-email-tom.leiming@gmail.com> References: <1283873014-32511-1-git-send-email-tom.leiming@gmail.com> 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]); Tue, 07 Sep 2010 15:25:18 +0000 (UTC) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 176e127..f3ee04f 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) 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;