summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2004-09-09 20:47:28 +0000
committerWarner Losh <imp@FreeBSD.org>2004-09-09 20:47:28 +0000
commit7e76a985ca0fecb81b8fc568eebda23d94095b24 (patch)
tree2dab0884391cc7d6c227301c58bf6081e5549513 /sys/dev
parent9c5638245406afc72252c7983e6d4cdcba3756ee (diff)
Notes
Diffstat (limited to 'sys/dev')
-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 6b930d1d4e21..adeb43697f91 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;