Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp396109pxj; Thu, 27 May 2021 02:51:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJXBnQDUXrWBn2e/ji6QbEgcCoG83v7GbPmpfTdUVOkLxuuzb03nyBuB1qtuMQhMBqKsI5 X-Received: by 2002:a05:6638:ecf:: with SMTP id q15mr2727014jas.126.1622109079216; Thu, 27 May 2021 02:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622109079; cv=none; d=google.com; s=arc-20160816; b=Yh0DB7N6qLeuSjJXg7hayxVrDcDnbu89PBmZbppnCG3sTvNujMnxEZBvyjdQIa0toa FEyfkoCcwhkRzRt3P5mO7ooo+22gcTbfUQxM91pBe1KpT0+AQe+b/q9XM5LB3cRfkMLJ HQuw2YabN8qN0uoasi72u/rrw0zS5fxVLIOKcNOBoXWFf9M5ez9TT1T7ibOyw6A6mdmd LeA7bw3saVm9A20fTXaU8dLOxe/81IBys8sviu1ITySayJkOQ/PcWd73FntYV520Dv/O FmvEy9PCRCeavaFpfZl9vfuPm1qhLJ8v9T5ZjT99CAkx2Tad9AB3L7JNsT5EEldDHi0v +Q8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fMGDWPvzg2QrOiDPplBQaPs01YrvrZY3jaoEtH4nkwI=; b=ggtU/4FFalbv2Y52SpWZw5npQI9PogRyoCSFnaPB/CeaYJD1SViGHKaUjAXTbLgNf6 XEkwjSlT0QdCyOVO2DvI92vIutDfrpQpkVe7VbQnLzzMW+cV6Rvyx/w77P1HLYViRQ68 YEAzQq9wo16/O8A2Qh5JWLDPrERY5SbzN39bBwTPTpn/y45qjF6rWoRmpR/yYEm9rtxZ ic+a1lR2kYd1iUP9qvdUEK2EzNN3qiHipo0iNxwmsv48u12J3wT5okqcgWlHd3vWvFJZ 0/tKhfZrw5iEdQ53HVa+VaxS7V64HRuuEUTbL2AexpYkb9vKoKpJGim31cy9qEffITvw ITvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VXLkNE34; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h17si2145015ila.72.2021.05.27.02.51.03; Thu, 27 May 2021 02:51:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VXLkNE34; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235964AbhE0Jvp (ORCPT + 99 others); Thu, 27 May 2021 05:51:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:42400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235809AbhE0Jvo (ORCPT ); Thu, 27 May 2021 05:51:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1CF87613F0; Thu, 27 May 2021 09:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622109010; bh=cmBGcT0eRQCBifI792Q3HjHvjS5nOyNVd0fvq4gyHIc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VXLkNE34YcBekZ+KiAEGlrxt8hnaZJWlF1hJj67aTiFuVJbWsub9+XFUcD84c9K2W UekIIAdHGPa9ToZWZ/gJguTBuoXKysZMnOT16ChOMEJXfiK05oL8F7O0stHUxldTiZ 2I+z2JsMRh8dhs8Uoa26Tx8L7iWQsIPirpXphd+8= Date: Thu, 27 May 2021 11:50:07 +0200 From: Greg Kroah-Hartman To: Mathias Nyman Cc: Lee Jones , linux-kernel@vger.kernel.org, Mathias Nyman , linux-usb@vger.kernel.org Subject: Re: [PATCH 17/24] usb: host: xhci: Remove unused variable 'len' Message-ID: References: <20210526130037.856068-1-lee.jones@linaro.org> <20210526130037.856068-18-lee.jones@linaro.org> <20210527081609.GF543307@dell> <5958f870-1834-3132-a729-2b26a84349ea@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5958f870-1834-3132-a729-2b26a84349ea@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 27, 2021 at 12:23:24PM +0300, Mathias Nyman wrote: > On 27.5.2021 11.16, Lee Jones wrote: > > On Thu, 27 May 2021, Greg Kroah-Hartman wrote: > > > >> On Wed, May 26, 2021 at 02:00:30PM +0100, Lee Jones wrote: > >>> Fixes the following W=1 kernel build warning(s): > >>> > >>> drivers/usb/host/xhci.c: In function ‘xhci_unmap_temp_buf’: > >>> drivers/usb/host/xhci.c:1349:15: warning: variable ‘len’ set but not used [-Wunused-but-set-variable] > >>> > >>> Cc: Mathias Nyman > >>> Cc: Greg Kroah-Hartman > >>> Cc: linux-usb@vger.kernel.org > >>> Signed-off-by: Lee Jones > >>> --- > >>> drivers/usb/host/xhci.c | 9 ++++----- > >>> 1 file changed, 4 insertions(+), 5 deletions(-) > >>> > >>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > >>> index 27283654ca080..ac2a7d4288883 100644 > >>> --- a/drivers/usb/host/xhci.c > >>> +++ b/drivers/usb/host/xhci.c > >>> @@ -1346,7 +1346,6 @@ static bool xhci_urb_temp_buffer_required(struct usb_hcd *hcd, > >>> > >>> static void xhci_unmap_temp_buf(struct usb_hcd *hcd, struct urb *urb) > >>> { > >>> - unsigned int len; > >>> unsigned int buf_len; > >>> enum dma_data_direction dir; > >>> > >>> @@ -1362,10 +1361,10 @@ static void xhci_unmap_temp_buf(struct usb_hcd *hcd, struct urb *urb) > >>> dir); > >>> > >>> if (usb_urb_dir_in(urb)) > >>> - len = sg_pcopy_from_buffer(urb->sg, urb->num_sgs, > >>> - urb->transfer_buffer, > >>> - buf_len, > >>> - 0); > >>> + sg_pcopy_from_buffer(urb->sg, urb->num_sgs, > >>> + urb->transfer_buffer, > >>> + buf_len, > >>> + 0); > >> > >> Sorry, but no, I keep rejecting this over and over, it needs to handle > >> the error handling properly and not paper over it like this :( > > > > Will fix. > > > >> All the bots keep tripping up on it, you are not alone. > > > > This is getting a lot of attention. Something like this should fix it: > > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > index 27283654ca08..306ab81421fd 100644 > --- a/drivers/usb/host/xhci.c > +++ b/drivers/usb/host/xhci.c > @@ -1361,12 +1361,16 @@ static void xhci_unmap_temp_buf(struct usb_hcd *hcd, struct urb *urb) > urb->transfer_buffer_length, > dir); > > - if (usb_urb_dir_in(urb)) > + if (usb_urb_dir_in(urb)) { > len = sg_pcopy_from_buffer(urb->sg, urb->num_sgs, > urb->transfer_buffer, > buf_len, > 0); > - > + if (len != buf_len) { > + xhci_dbg(xhci, "Copy from tmp buf to urb sg list failed\n"); > + urb->actual_length = len; > + } > + } > urb->transfer_flags &= ~URB_DMA_MAP_SINGLE; > kfree(urb->transfer_buffer); > urb->transfer_buffer = NULL; > > urb->actual_length is now properly set. > The debug level message will help me find the cause if we ever need > to debug oddly behaving devices. > > Note this is a very rarly taken codepath for quirky xHC harware that > can't handle a specific sequence of buffer lengths queued. > > I can write a proper commit message and push this forward That looks good, I kept waiting for one of the people who kept trying to report "build warning fixes" to do it right, but I'll gladly take it from you as well :) thanks, greg k-h