summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-12-15 15:36:41 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-12-15 15:36:41 +0000
commitb1f99f9cc9787aebc5856786e5199c843679752e (patch)
treea5b5aba2d7818065048bd6e5467cc4ffd4ec10dd /sys
parentff9c6d3f09d14b02b30a7f1bbf0613a8a23ec0f5 (diff)
downloadsrc-test2-b1f99f9cc9787aebc5856786e5199c843679752e.tar.gz
src-test2-b1f99f9cc9787aebc5856786e5199c843679752e.zip
Improve handling of alternate settings in the USB stack.
Move initialization of num_altsetting under USB_CFG_INIT, else there will be a page fault when enumerating USB devices. PR: 251856 MFC after: 1 week Submitted by: Ma, Horse <Shichun.Ma@dell.com> Sponsored by: Mellanox Technologies // NVIDIA Networking
Notes
Notes: svn path=/head/; revision=368664
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/usb_device.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index cc679611a832..322e4f5401ba 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -897,6 +897,9 @@ usb_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd)
/* initialise interface */
do_init = 1;
}
+ /* update number of alternate settings, if any */
+ if (iface_index == USB_IFACE_INDEX_ANY)
+ iface->num_altsetting = ips.iface_index_alt + 1;
} else
do_init = 0;
@@ -905,9 +908,6 @@ usb_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd)
/* update current number of endpoints */
ep_curr = ep_max;
}
- /* update number of alternate settings, if any */
- if (iface_index == USB_IFACE_INDEX_ANY)
- iface->num_altsetting = ips.iface_index_alt + 1;
/* check for init */
if (do_init) {