From patchwork Fri Oct 17 17:09:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 38907 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0E459202DB for ; Fri, 17 Oct 2014 17:10:40 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id q1sf717839lam.0 for ; Fri, 17 Oct 2014 10:10:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=lC93imb+v2sOUsoZLtwj5LGQfXXIfAki75ukRTsS0oA=; b=CD+0XHH4nYwOfBuzbbTzKng+uTtQHIQGRjwYemYK9g/KKobIbE3vDCiQVYcoT1JDf7 6wE7xsioltl8/Rueu57L13MpMmCLHehZxlIjEdCh3o0mH9q4MuVSOOyfdkrUkfwhtgrF 2m+WnzHdKapvFmQi9ARPmoaLThf0JPGJvyVbYXBa/8B+EiFk7GDFBEsLh6XscOsYUmPO BXbbu8051s9mZ8MeFKCMzwUeCUFnXDagfriCKaPnQJkASFvaCl4rWALTs5KkvYBLMkDU LnytfK4atoo6ngW/pNqlghEpEouw2avQkROAUYq41mLRJtAjK4JLair6cpmq9eEGX4lK +H9w== X-Gm-Message-State: ALoCoQniuihDd7/iiak2el6jmAr8Iq90wgEVMVb4JHINdI2Gm4PwMxNCbfnuU8POA6tlN62I9jLn X-Received: by 10.194.118.197 with SMTP id ko5mr1571348wjb.2.1413565839684; Fri, 17 Oct 2014 10:10:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.200 with SMTP id le8ls288386lab.101.gmail; Fri, 17 Oct 2014 10:10:39 -0700 (PDT) X-Received: by 10.112.137.39 with SMTP id qf7mr10074361lbb.47.1413565839529; Fri, 17 Oct 2014 10:10:39 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id dl8si2965597lad.68.2014.10.17.10.10.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 10:10:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id 10so1042058lbg.18 for ; Fri, 17 Oct 2014 10:10:39 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr1919239lbw.66.1413565839118; Fri, 17 Oct 2014 10:10:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp266726lbz; Fri, 17 Oct 2014 10:10:38 -0700 (PDT) X-Received: by 10.68.65.74 with SMTP id v10mr9834367pbs.96.1413565837614; Fri, 17 Oct 2014 10:10:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si1697524pdo.45.2014.10.17.10.10.37 for ; Fri, 17 Oct 2014 10:10:37 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753549AbaJQRKf (ORCPT + 3 others); Fri, 17 Oct 2014 13:10:35 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:55464 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752032AbaJQRKc (ORCPT ); Fri, 17 Oct 2014 13:10:32 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HHAWqg011125 for ; Fri, 17 Oct 2014 12:10:32 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAWBp023182 for ; Fri, 17 Oct 2014 12:10:32 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 12:10:32 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAVLH027051; Fri, 17 Oct 2014 12:10:32 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH 17/28] usb: dwc3: ep0: return early on NULL requests Date: Fri, 17 Oct 2014 12:09:53 -0500 Message-ID: <1413565804-13061-18-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT In-Reply-To: <1413565804-13061-1-git-send-email-balbi@ti.com> References: <1413565804-13061-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , if our list of requests is empty, return early. There's really nothing to be done in case our request list is empty anyway because the only situation where we our list is empty, is when we're transferring ZLPs. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/ep0.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index ae6b575..a47cc1e 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -789,9 +789,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; - r = next_request(&ep0->request_list); - ur = &r->request; - trb = dwc->ep0_trb; status = DWC3_TRB_SIZE_TRBSTS(trb->size); @@ -804,6 +801,12 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, return; } + r = next_request(&ep0->request_list); + if (!r) + return; + + ur = &r->request; + length = trb->size & DWC3_TRB_SIZE_MASK; if (dwc->ep0_bounced) {