Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/usbdevs Fix previous... handle hub ports



details:   https://anonhg.NetBSD.org/src/rev/65cc0d6fa14a
branches:  trunk
changeset: 347624:65cc0d6fa14a
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Sep 07 08:09:59 2016 +0000

description:
Fix previous... handle hub ports

diffstat:

 usr.sbin/usbdevs/usbdevs.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 865da20b7d43 -r 65cc0d6fa14a usr.sbin/usbdevs/usbdevs.c
--- a/usr.sbin/usbdevs/usbdevs.c        Wed Sep 07 08:05:02 2016 +0000
+++ b/usr.sbin/usbdevs/usbdevs.c        Wed Sep 07 08:09:59 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdevs.c,v 1.34 2016/09/07 08:05:02 skrll Exp $       */
+/*     $NetBSD: usbdevs.c,v 1.35 2016/09/07 08:09:59 skrll Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: usbdevs.c,v 1.34 2016/09/07 08:05:02 skrll Exp $");
+__RCSID("$NetBSD: usbdevs.c,v 1.35 2016/09/07 08:09:59 skrll Exp $");
 #endif
 
 #include <stdio.h>
@@ -205,7 +205,7 @@
 usbdev(int f, int a, int rec)
 {
        struct usb_device_info di;
-       int e, p, i;
+       int e, i;
 
        di.udi_addr = a;
        e = ioctl(f, USB_DEVICEINFO, &di);
@@ -261,7 +261,10 @@
        }
        if (!rec)
                return;
-       for (p = 0; p < di.udi_nports && p < __arraycount(di.udi_ports); p++) {
+
+       unsigned int nports = di.udi_nports;
+
+       for (unsigned int p = 0; p < nports && p < __arraycount(di.udi_ports); p++) {
                int s = di.udi_ports[p];
                if (s >= USB_MAX_DEVICES) {
                        if (verbose) {



Home | Main Index | Thread Index | Old Index