From 8bbce6f6a981bed16d8887f0619d11f8fddf5cfe Mon Sep 17 00:00:00 2001 From: hselasky Date: Wed, 28 Jan 2015 19:43:33 +0000 Subject: [PATCH] MFC r277417: Fix returned data for the USB_GET_DEV_PORT_PATH IOCTL in particular the value returned in the "udp_port_level" field. git-svn-id: svn://svn.freebsd.org/base/stable/9@277846 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/usb/usb_generic.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/usb_generic.c b/sys/dev/usb/usb_generic.c index c63c5c723..e01c94f64 100644 --- a/sys/dev/usb/usb_generic.c +++ b/sys/dev/usb/usb_generic.c @@ -1837,14 +1837,13 @@ ugen_get_port_path(struct usb_fifo *f, struct usb_device_port_path *dpp) if (nlevel > USB_DEVICE_PORT_PATH_MAX) goto error; + /* store total level of ports */ + dpp->udp_port_level = nlevel; + /* store port index array */ next = udev; while (next->parent_hub != NULL) { - nlevel--; - - dpp->udp_port_no[nlevel] = next->port_no; - dpp->udp_port_level = nlevel; - + dpp->udp_port_no[--nlevel] = next->port_no; next = next->parent_hub; } return (0); /* success */ -- 2.45.0