summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/usb/usb_subr.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c
index 6b930d1..adeb436 100644
--- a/sys/dev/usb/usb_subr.c
+++ b/sys/dev/usb/usb_subr.c
@@ -905,6 +905,10 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev,
if (dv) {
return (USBD_NORMAL_COMPLETION);
}
+ /*
+ * Free subdevs so we can reallocate it larger for the number of
+ * interfaces
+ */
tmpdv = dev->subdevs;
dev->subdevs = NULL;
free(tmpdv, M_USB);
@@ -1016,9 +1020,6 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev,
if (dv != NULL) {
return (USBD_NORMAL_COMPLETION);
}
- tmpdv = dev->subdevs;
- dev->subdevs = 0;
- free(tmpdv, M_USB);
/*
* The generic attach failed, but leave the device as it is.
@@ -1346,11 +1347,13 @@ usbd_fill_deviceinfo(usbd_device_handle dev, struct usb_device_info *di,
di->udi_speed = dev->speed;
if (dev->subdevs != NULL) {
- for (i = 0; dev->subdevs[i] &&
- i < USB_MAX_DEVNAMES; i++) {
- strncpy(di->udi_devnames[i], USBDEVPTRNAME(dev->subdevs[i]),
- USB_MAX_DEVNAMELEN);
- di->udi_devnames[i][USB_MAX_DEVNAMELEN-1] = '\0';
+ for (i = 0; dev->subdevs[i] && i < USB_MAX_DEVNAMES; i++) {
+ if (device_is_attached(dev->subdevs[i]))
+ strlcpy(di->udi_devnames[i],
+ USBDEVPTRNAME(dev->subdevs[i]),
+ USB_MAX_DEVNAMELEN);
+ else
+ di->udi_devnames[i][0] = 0;
}
} else {
i = 0;
OpenPOWER on IntegriCloud