NetBSD Problem Report #52791
From www@NetBSD.org Thu Dec 7 21:57:18 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 56A107A178
for <gnats-bugs@gnats.NetBSD.org>; Thu, 7 Dec 2017 21:57:18 +0000 (UTC)
Message-Id: <20171207215717.583CA7A1EC@mollari.NetBSD.org>
Date: Thu, 7 Dec 2017 21:57:17 +0000 (UTC)
From: webpages@sprow.co.uk
Reply-To: webpages@sprow.co.uk
To: gnats-bugs@NetBSD.org
Subject: Duplicate test in XHCI's TT hub handling
X-Send-Pr-Version: www-1.0
>Number: 52791
>Category: kern
>Synopsis: Duplicate test in XHCI's TT hub handling
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Dec 07 22:00:00 +0000 2017
>Closed-Date: Thu Dec 21 22:42:03 +0000 2017
>Last-Modified: Thu Dec 21 22:42:03 +0000 2017
>Originator: Robert Sprowson
>Release:
>Organization:
>Environment:
>Description:
When checking the conditions for turning on TT hub support, a check is made whether dev->ud_myhub is NULL before proceeding to picking the pointer for the ud_depth member.
In the same expression it's checked again before picking the ud_speed member.
There's no need to check it twice, C will evaluate the expression in the order it's written.
See patch against src/sys/dev/usb/xhci.c (same construct twice).
>How-To-Repeat:
>Fix:
--- xhci.1.77.c 2017-11-17 08:22:02.0 +0000
+++ xhci.c 2017-12-07 21:49:29.0 +0000
@@ -3179,8 +3179,7 @@
*/
if (dev->ud_myhsport != NULL &&
dev->ud_myhub != NULL && dev->ud_myhub->ud_depth != 0 &&
- (dev->ud_myhub != NULL &&
- dev->ud_myhub->ud_speed == USB_SPEED_HIGH) &&
+ dev->ud_myhub->ud_speed == USB_SPEED_HIGH &&
(speed == USB_SPEED_LOW || speed == USB_SPEED_FULL)) {
ttportnum = dev->ud_myhsport->up_portno;
tthubslot = dev->ud_myhsport->up_parent->ud_addr;
@@ -3221,8 +3220,7 @@
else if (!ishub &&
(speed == USB_SPEED_LOW || speed == USB_SPEED_FULL) &&
dev->ud_myhub != NULL && dev->ud_myhub->ud_depth != 0 &&
- (dev->ud_myhub != NULL &&
- dev->ud_myhub->ud_speed == USB_SPEED_HIGH) &&
+ dev->ud_myhub->ud_speed == USB_SPEED_HIGH &&
dev->ud_myhsport != NULL &&
IS_TTHUB(&dev->ud_myhsport->up_parent->ud_ddesc))
usemtt = true;
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52791 CVS commit: src/sys/dev/usb
Date: Thu, 7 Dec 2017 17:56:23 -0500
Module Name: src
Committed By: christos
Date: Thu Dec 7 22:56:23 UTC 2017
Modified Files:
src/sys/dev/usb: xhci.c
Log Message:
PR/52791: Robert Sprowson: avoid duplicate tests (use accessor variables)
To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/usb/xhci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52791 CVS commit: [netbsd-8] src/sys/dev/usb
Date: Thu, 21 Dec 2017 21:53:32 +0000
Module Name: src
Committed By: snj
Date: Thu Dec 21 21:53:32 UTC 2017
Modified Files:
src/sys/dev/usb [netbsd-8]: xhci.c
Log Message:
Pull up following revision(s) (requested by skrll in ticket #459):
sys/dev/usb/xhci.c: 1.78, 1.83
PR/52791: Robert Sprowson: avoid duplicate tests (use accessor variables)
--
Fix the logic around TT Hub Slot ID, TT Port Number and Multi-TT in
xhci_setup_tthub. TT Hub/Port need to reference the upstream HS hub and
Multi-TT needs to reflect the capabilities of a HS hub itself or the same
upstream HS hub.
To generate a diff of this commit:
cvs rdiff -u -r1.72.2.4 -r1.72.2.5 src/sys/dev/usb/xhci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Thu, 21 Dec 2017 22:42:03 +0000
State-Changed-Why:
christos handled it. thanks!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.