Skip to content

Commit 45cd294

Browse files
committed
usb: use only usb_devinfo() in device_set_usb_desc()
device_set_usb_desc() first tries to fetch device information through the iInterface descriptor, otherwise it falls back to usb_devinfo(). Since usb_devinfo() is both guaranteed to work, and is more verbose, get rid of the initial iInterface attempt. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D43383
1 parent ebc9b69 commit 45cd294

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

sys/dev/usb/usb_util.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ device_set_usb_desc(device_t dev)
7373
{
7474
struct usb_attach_arg *uaa;
7575
struct usb_device *udev;
76-
struct usb_interface *iface;
7776
char *temp_p;
78-
usb_error_t err;
7977
uint8_t do_unlock;
8078

8179
if (dev == NULL) {
@@ -88,33 +86,11 @@ device_set_usb_desc(device_t dev)
8886
return;
8987
}
9088
udev = uaa->device;
91-
iface = uaa->iface;
92-
93-
if ((iface == NULL) ||
94-
(iface->idesc == NULL) ||
95-
(iface->idesc->iInterface == 0)) {
96-
err = USB_ERR_INVAL;
97-
} else {
98-
err = 0;
99-
}
10089

10190
/* Protect scratch area */
10291
do_unlock = usbd_ctrl_lock(udev);
103-
10492
temp_p = (char *)udev->scratch.data;
105-
106-
if (err == 0) {
107-
/* try to get the interface string ! */
108-
err = usbd_req_get_string_any(udev, NULL, temp_p,
109-
sizeof(udev->scratch.data),
110-
iface->idesc->iInterface);
111-
}
112-
if (err != 0) {
113-
/* use default description */
114-
usb_devinfo(udev, temp_p,
115-
sizeof(udev->scratch.data));
116-
}
117-
93+
usb_devinfo(udev, temp_p, sizeof(udev->scratch.data));
11894
if (do_unlock)
11995
usbd_ctrl_unlock(udev);
12096

0 commit comments

Comments
 (0)