Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp549719img; Mon, 18 Mar 2019 08:55:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhBLIpNaWgT5ktkxoEaj9go3lR9DGoBNHfJM+ap6iRDg1euWz7Ka8pYQZqX1D+kjD/2433 X-Received: by 2002:a65:538e:: with SMTP id x14mr17750346pgq.79.1552924527647; Mon, 18 Mar 2019 08:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552924527; cv=none; d=google.com; s=arc-20160816; b=opvokxLiDuPMd/U3BxxLPfoSW9BfR0OeGfbsnqk0rysfvZoSudS+tojNgVqYiBjg7B uvkDqqBsfjXArq1sOFIPrW5VSI4To6onnCjAbKFFjWfJ7W/McW49izoPP+HlwiHQJzkV 3n9MOHwByWaLnDcK6C6R0dHmlhjs6bL/qgiViAToDmkAvLME8zp1jIDTwx5f28Uhtske UQJF3uOMrTEfNc0QcKhiM3+wx5fQ1nLZgMwvGhYIwif5UmZnuSsz63qzVv7QQyDOcIUZ wu+CdjkY9I0g9wyXrCYZDSC0Z1MHDMZPpJfp32bJzGcc+/41Zlro9SBhowtAAPILj+Oa Xi0w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-data:ironport-sdr :dkim-signature; bh=BK+fU8FJWFwFj7sIQvL8kItbHrwE/iPD0L3Fv5M+NlI=; b=a66WtiqySqujW1AsneHBvK1cTDi840N0NWDQ6ImX0YZISo+XJSdNtxPTAV+IauVUVU vJVls10EeOGGOLJPT61oH88QmC3SGtY4Bxu/jr1deIQfXlp1MIxw6vYONExwmV3HIZjO PcHne0OV1t7W0qzYaQZsu3ovedJTL8v0EbvdjjNC4gkQ4mRpzRjzvkyHviqdGnF+C9Wk EeEsgKqKlOP/Pn8N5kKvBXHqoAbpYs3nSwnMBzKkLnDchjgWP8AjfltgDe74D71Nhcyh BS11VzWypRf6c/1M53aRBMzY8ltsSkw1xg2aDqLKjcxC1F9DdhAsVWAkvZAetGkWR1/v TCuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@skidata.com header.s=selector1 header.b=XG4pvG51; 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 f73si9760651pff.184.2019.03.18.08.55.11; Mon, 18 Mar 2019 08:55:27 -0700 (PDT) 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=fail header.i=@skidata.com header.s=selector1 header.b=XG4pvG51; 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 S1727952AbfCRPxr (ORCPT + 99 others); Mon, 18 Mar 2019 11:53:47 -0400 Received: from mail1.skidata.com ([91.230.2.99]:22997 "EHLO mail1.skidata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727915AbfCRPxn (ORCPT ); Mon, 18 Mar 2019 11:53:43 -0400 X-Greylist: delayed 428 seconds by postgrey-1.27 at vger.kernel.org; Mon, 18 Mar 2019 11:53:41 EDT DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=skidata.com; i=@skidata.com; q=dns/txt; s=selector1; t=1552924422; x=1584460422; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=GxAeHEsDJIB64+V8841adqPaOZ/GZ0UvCz29xLXLyAo=; b=XG4pvG51PVjkBRgI9uv06IC14Y5CvyHmcVDrBRbwXvD3C1fH7MBWwVPj /QrBzh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4mue9uzhNPIFTS0bCSrB8dXpPpSEZhp XMorgz3SHXdQvB4kDtRxkAEFNKTKqCe/mVbYrl+g0z8vS9k3MaSxfYD0l4oa5f7bdE1FeIep 5AgtFBsRXZUQaVZKJ2f7LuN4oyYfmJaGFgtRHzwXWzERI8b+YRxmH918acLcz0vdvW/6GTiJ 9hXe8zhe46AaguBul+Brj82uq8U6/p00LJGIS52TrOFvgFFgGzY5pbWGoXbiR4hIipNAY3QG A9tw4unRXQt2Sz7hMTRa2FYxff4W0JeYQgwkAJXux6g+ZrWxtq8+LbbR+RGONqusMLiMiLOK dK+HANKwFwuAJvpC7n7nZw83BTKp+5rE6l+DsZb+LvCisi/ewBoOfOF2Uir7qnat0IJk7oA2 EIiLPyhIg= X-IronPort-AV: E=Sophos;i="5.58,494,1544482800"; d="scan'208";a="15819580" Subject: Re: [PATCH] usb: usb251xb: Remove unnecessary comparison of unsigned integer with >= 0 To: Marco Felsch , "Gustavo A. R. Silva" CC: Greg Kroah-Hartman , , References: <20190318145024.GA572@embeddedor> <20190318153425.rxx3fwq2hi6tfocr@pengutronix.de> From: Richard Leitner Message-ID: Date: Mon, 18 Mar 2019 16:46:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190318153425.rxx3fwq2hi6tfocr@pengutronix.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.111.22] X-ClientProxiedBy: sdex3srv.skidata.net (192.168.111.81) To sdex5srv.skidata.net (192.168.111.83) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marco, Hi Gustavo, thanks for the fix, please feel free to add Reviewed-by: Richard Leitner On 18/03/2019 16:34, Marco Felsch wrote: > Hi Silva, > > On 19-03-18 09:50, Gustavo A. R. Silva wrote: >> There is no need to compare *port* with >= 0 because such comparison >> of an unsigned value is always true. > > Absolutly.. It seems that it was an copy'n'paste failure. Thanks for > fixing that. A small note on further improvement from my side: According the datasheet, when you set swap-dx-lanes to 0 (-> setting port to 0 -> setting bit 0 of PRTSP) " the upstream port DP/DM is swapped". IMHO this is not straight-forward, so maybe we want to additionally a) mention it somewhere in the documentation b) check on port >= 1 c) something else? Any opinions on that from your side? ... I'd prefer "a"... regards;Richard.L > > Regards, > Marco > >> Fix this by removing such comparison. >> >> Addresses-Coverity-ID: 1443949 ("Unsigned compared against 0") >> Fixes: 02a50b875046 ("usb: usb251xb: add usb data lane port swap feature") >> Signed-off-by: Gustavo A. R. Silva >> --- >> drivers/usb/misc/usb251xb.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c >> index 4d72b7d1d383..2c8e2cad7e10 100644 >> --- a/drivers/usb/misc/usb251xb.c >> +++ b/drivers/usb/misc/usb251xb.c >> @@ -547,7 +547,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, >> */ >> hub->port_swap = USB251XB_DEF_PORT_SWAP; >> of_property_for_each_u32(np, "swap-dx-lanes", prop, p, port) { >> - if ((port >= 0) && (port <= data->port_cnt)) >> + if (port <= data->port_cnt) >> hub->port_swap |= BIT(port); >> } >> >> -- >> 2.21.0 >> >> >