Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Fix two bugs



details:   https://anonhg.NetBSD.org/src/rev/6c5cc91264cc
branches:  trunk
changeset: 1027743:6c5cc91264cc
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Dec 18 14:48:14 2021 +0000

description:
Fix two bugs

i)  EHCI_HCSPARAMS should be read with EREAD4 (and not EOREAD4). Spotted by
    jmcneill

ii) Apply brackets so that ?: vs | operator precedence doesn't give the
    wrong result.

diffstat:

 sys/dev/usb/ehci.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (33 lines):

diff -r 47c302291dca -r 6c5cc91264cc sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sat Dec 18 13:23:09 2021 +0000
+++ b/sys/dev/usb/ehci.c        Sat Dec 18 14:48:14 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.290 2021/12/07 08:04:10 skrll Exp $ */
+/*     $NetBSD: ehci.c,v 1.291 2021/12/18 14:48:14 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.290 2021/12/07 08:04:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.291 2021/12/18 14:48:14 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2426,11 +2426,10 @@
                totlen = uimin(buflen, sizeof(hubd));
                memcpy(&hubd, buf, totlen);
                hubd.bNbrPorts = sc->sc_noport;
-               v = EOREAD4(sc, EHCI_HCSPARAMS);
+               v = EREAD4(sc, EHCI_HCSPARAMS);
                USETW(hubd.wHubCharacteristics,
-                   EHCI_HCS_PPC(v) ? UHD_PWR_INDIVIDUAL : UHD_PWR_NO_SWITCH |
-                   EHCI_HCS_P_INDICATOR(EREAD4(sc, EHCI_HCSPARAMS))
-                       ? UHD_PORT_IND : 0);
+                   (EHCI_HCS_PPC(v) ? UHD_PWR_INDIVIDUAL : UHD_PWR_NO_SWITCH) |
+                   (EHCI_HCS_P_INDICATOR(v) ? UHD_PORT_IND : 0));
                hubd.bPwrOn2PwrGood = 200; /* XXX can't find out? */
                for (i = 0, l = sc->sc_noport; l > 0; i++, l -= 8, v >>= 8)
                        hubd.DeviceRemovable[i++] = 0; /* XXX can't find out? */



Home | Main Index | Thread Index | Old Index