Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp837949imu; Tue, 11 Dec 2018 08:19:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/Ul1+B+zhK0S/2x7ZuQt3ciVIQUDRN1S2yVv6RUueCEbHcwDEaM0glmMskyxcI6gHYfAD1z X-Received: by 2002:a62:9f01:: with SMTP id g1mr16817974pfe.223.1544545152323; Tue, 11 Dec 2018 08:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544545152; cv=none; d=google.com; s=arc-20160816; b=CNzAWo5AMO8eiPfs3D8VLzV6V6NZpyrhdfZsx3VLh8AmYbq2yiHaLoKgQXgF9narsG W/6EzuEjcHFjFwrx8wfFLsfArYJwodfGOT6JMfYLKwM+evxEcXu1iyBGEx1Vne3sSLe1 AkzE/nn7jRlt/sAt/F52XrfdaupgKgjjlFy7Hj6qPc4yIP1AFEzA2pk9DyTda0yruRx6 7pl8Bs04nJS9+zFEdRqcX5cqaKyfqn5ByPUWivhuNQJ7Tpxrd7PGWBwsz2rJWWMRbCMY IgBK+JP+Q+lrXqk3QRc6TJV0Tw+99vSmSgmMEO6GleXKuhf89IsSMdqm7WeF+M/p0NQ6 6Z4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fol1bnY8ZPjb7x6z5bFznWszJhbOXmn63vu2LfPnQFA=; b=qXluPQoM1BC0ngQPHBK0dsW3G/ilzN3ZxUEwQPKyDiNRAFUBf90m6aVJESUHNHbVqG WFtglzIt72LfCxORmEdFVUaM2BzDyV8/ZAv19zhD6+oKTnfHItWV9BQBmmSkoCy3oaM2 /nCnrrVhv1NEQlgxaR7bLulc1pyrBYrVcu39XUL/mFozHRPgo7sLz6gwx9UvDOpuHUzm PK+17E1aihu3ACtQh6Bst5Pu2PdiWGlcqw8eK9iXcELidcSE9zg3XRh9Q7BHFtNFW2Gt c3u79ttxZcCOIFIbsBRw/4Vz/uijiEtXqMI6RMrV6SyM7iCrhdL/weraCXojzN3t5hpB o3oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=do2o5CyS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si13343267plh.274.2018.12.11.08.18.34; Tue, 11 Dec 2018 08:19:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=do2o5CyS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728542AbeLKQPx (ORCPT + 99 others); Tue, 11 Dec 2018 11:15:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:36780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728791AbeLKPsY (ORCPT ); Tue, 11 Dec 2018 10:48:24 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3CBE92146D; Tue, 11 Dec 2018 15:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543303; bh=LRnErc5/7x8PakxExb7XSzYdBuqndEpBhRY25UXcHOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=do2o5CySGvSzV25Es2LOO5hewBIMUKhiby/3yPD/UFOJL0EDFdfanXWFijJ0x6Pje K/YjjbUTNbifqtKA+Ef+GY1o4lqkQ9QBkYKrTFHb6N1JbygJG6SoA0SZ8fJxUWypgl fUs4Dy2iW6SFszmNoiGRwJ0ArMrSgQCKkLaQtkEU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tatyana Brokhman , Felipe Balbi , Alan Stern , Arnd Bergmann , Felipe Balbi Subject: [PATCH 4.4 56/91] usb: gadget: dummy: fix nonsensical comparisons Date: Tue, 11 Dec 2018 16:41:15 +0100 Message-Id: <20181211151610.606344036@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151606.026852373@linuxfoundation.org> References: <20181211151606.026852373@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 7661ca09b2ff98f48693f431bb01fed62830e433 upstream. gcc-8 points out two comparisons that are clearly bogus and almost certainly not what the author intended to write: drivers/usb/gadget/udc/dummy_hcd.c: In function 'set_link_state_by_speed': drivers/usb/gadget/udc/dummy_hcd.c:379:31: error: bitwise comparison always evaluates to false [-Werror=tautological-compare] USB_PORT_STAT_ENABLE) == 1 && ^~ drivers/usb/gadget/udc/dummy_hcd.c:381:25: error: bitwise comparison always evaluates to false [-Werror=tautological-compare] USB_SS_PORT_LS_U0) == 1 && ^~ I looked at the code for a bit and came up with a change that makes it look like what the author probably meant here. This makes it look reasonable to me and to gcc, shutting up the warning. It does of course change behavior as the two conditions are actually evaluated rather than being hardcoded to false, and I have made no attempt at verifying that the changed logic makes sense in the context of a USB HCD, so that part needs to be reviewed carefully. Fixes: 1cd8fd2887e1 ("usb: gadget: dummy_hcd: add SuperSpeed support") Cc: Tatyana Brokhman Cc: Felipe Balbi Acked-by: Alan Stern Signed-off-by: Arnd Bergmann Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/dummy_hcd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -379,11 +379,10 @@ static void set_link_state_by_speed(stru USB_PORT_STAT_CONNECTION) == 0) dum_hcd->port_status |= (USB_PORT_STAT_C_CONNECTION << 16); - if ((dum_hcd->port_status & - USB_PORT_STAT_ENABLE) == 1 && - (dum_hcd->port_status & - USB_SS_PORT_LS_U0) == 1 && - dum_hcd->rh_state != DUMMY_RH_SUSPENDED) + if ((dum_hcd->port_status & USB_PORT_STAT_ENABLE) && + (dum_hcd->port_status & + USB_PORT_STAT_LINK_STATE) == USB_SS_PORT_LS_U0 && + dum_hcd->rh_state != DUMMY_RH_SUSPENDED) dum_hcd->active = 1; } } else {