From patchwork Mon Nov 10 20:37:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 40535 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7D5BE203C0 for ; Mon, 10 Nov 2014 20:37:37 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id mc6sf5665477lab.3 for ; Mon, 10 Nov 2014 12:37:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:subject:message-id :reply-to:references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=75UQkzEZavb8n3smwqJvtVwfbc27DcrEzbHMV0SD1Yg=; b=hmrHEDYAglLcJ8z5g75bOX0SapgkpY5S5G5/38CEjZPSs5AQIQmMqhetlVq7dqQmwY OXA0ZuqRPIwww/NcTLzEIPIZAPo7TbrnS2H4BAwCVtvDjT+dqAFruJXYV1jGdaegpFsJ ianCRmRrS6A5syOLbCkCisJmMBJ0P3ZZuiPcLKQu0hxInDiRP0GmcAtzkuoWtiTsrXtG 6fo9v6sPmtq+GcVzvzU2QCYJuBEvugoS00w1iOulDBxi23cvXWEOSaDySGi+HmyGrvyF sXlEkXrQtDNHEBq8orgi7TkCmXyLWEyx2kcFo6+awunVrIueBG7ufOtIAu8GFEVirk4a Y5SA== X-Gm-Message-State: ALoCoQnO8bTiwyX81mDBiElMEA3COmPXXZO1COHdzSKp/xlhRXPgW05E5WKt57M/iSbMB1EYxGFS X-Received: by 10.180.90.234 with SMTP id bz10mr4453532wib.0.1415651850363; Mon, 10 Nov 2014 12:37:30 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.6.36 with SMTP id cr4ls504183lad.41.gmail; Mon, 10 Nov 2014 12:37:30 -0800 (PST) X-Received: by 10.152.6.228 with SMTP id e4mr32032309laa.71.1415651850066; Mon, 10 Nov 2014 12:37:30 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id p7si15252484lah.133.2014.11.10.12.37.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Nov 2014 12:37:27 -0800 (PST) Received-SPF: temperror (google.com: error in processing during lookup of patch+caf_=patchwork-forward=linaro.org@linaro.org: DNS timeout) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id q1so8460671lam.38 for ; Mon, 10 Nov 2014 12:37:27 -0800 (PST) X-Received: by 10.152.29.8 with SMTP id f8mr32123358lah.56.1415651847840; Mon, 10 Nov 2014 12:37:27 -0800 (PST) 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.184.201 with SMTP id ew9csp160708lbc; Mon, 10 Nov 2014 12:37:26 -0800 (PST) X-Received: by 10.70.92.49 with SMTP id cj17mr35210122pdb.82.1415651845351; Mon, 10 Nov 2014 12:37:25 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id re4si12919191pdb.252.2014.11.10.12.37.24 for ; Mon, 10 Nov 2014 12:37:25 -0800 (PST) Received-SPF: none (google.com: linux-kernel-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 S1752741AbaKJUhT (ORCPT + 25 others); Mon, 10 Nov 2014 15:37:19 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:58111 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751762AbaKJUhO (ORCPT ); Mon, 10 Nov 2014 15:37:14 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id sAAKbBTr030133; Mon, 10 Nov 2014 14:37:11 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAAKbBnN009060; Mon, 10 Nov 2014 14:37:11 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Mon, 10 Nov 2014 14:37:10 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAAKbAHf008237; Mon, 10 Nov 2014 14:37:10 -0600 Date: Mon, 10 Nov 2014 14:37:39 -0600 From: Felipe Balbi To: Dave Jones , Linux Kernel Mailing List , Subject: Re: usb: dwc3: ep0: return early on NULL requests Message-ID: <20141110203739.GD1041@saruman> Reply-To: References: <20141101222047.7178B6610BF@gitolite.kernel.org> <20141110203229.GA31249@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20141110203229.GA31249@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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=temperror (google.com: error in processing during lookup of patch+caf_=patchwork-forward=linaro.org@linaro.org: DNS timeout) 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: , On Mon, Nov 10, 2014 at 03:32:29PM -0500, Dave Jones wrote: > On Sat, Nov 01, 2014 at 10:20:47PM +0000, Linux Kernel wrote: > > Gitweb: http://git.kernel.org/linus/;a=commit;h=6856d30c6c0038dc0648009853533af3af6c5ba8 > > Commit: 6856d30c6c0038dc0648009853533af3af6c5ba8 > > Parent: 7d643664ea559b36188cae264047ce3c9bfec3a2 > > Refname: refs/heads/master > > Author: Felipe Balbi > > AuthorDate: Tue Sep 30 11:43:20 2014 -0500 > > Committer: Felipe Balbi > > CommitDate: Mon Oct 20 15:58:49 2014 -0500 > > > > usb: dwc3: ep0: return early on NULL requests > > > > if our list of requests is empty, return early. > > .... > > > 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; > > > Since the deletion of this assignment to 'r', we're now doing > a comparison on it, resulting in dead code that will never be > reached.. very true, here's a patch to fix it up again :-) i'll send it properly in a bit. diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 711b230..df38e7e 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -791,6 +791,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, trb = dwc->ep0_trb; + r = next_request(&ep0->request_list); + if (!r) + return; + status = DWC3_TRB_SIZE_TRBSTS(trb->size); if (status == DWC3_TRBSTS_SETUP_PENDING) { dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); @@ -801,10 +805,6 @@ 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;