Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jan 2024 16:50:09 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 45cd29412ead - main - usb: use only usb_devinfo() in device_set_usb_desc()
Message-ID:  <202401161650.40GGo98v075400@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=45cd29412eadbb0e8c40590a94b10663addac17a

commit 45cd29412eadbb0e8c40590a94b10663addac17a
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-01-16 16:49:08 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-01-16 16:49:08 +0000

    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
---
 sys/dev/usb/usb_util.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/sys/dev/usb/usb_util.c b/sys/dev/usb/usb_util.c
index f9d50bdefdea..cd2dd7d6039e 100644
--- a/sys/dev/usb/usb_util.c
+++ b/sys/dev/usb/usb_util.c
@@ -73,9 +73,7 @@ device_set_usb_desc(device_t dev)
 {
 	struct usb_attach_arg *uaa;
 	struct usb_device *udev;
-	struct usb_interface *iface;
 	char *temp_p;
-	usb_error_t err;
 	uint8_t do_unlock;
 
 	if (dev == NULL) {
@@ -88,33 +86,11 @@ device_set_usb_desc(device_t dev)
 		return;
 	}
 	udev = uaa->device;
-	iface = uaa->iface;
-
-	if ((iface == NULL) ||
-	    (iface->idesc == NULL) ||
-	    (iface->idesc->iInterface == 0)) {
-		err = USB_ERR_INVAL;
-	} else {
-		err = 0;
-	}
 
 	/* Protect scratch area */
 	do_unlock = usbd_ctrl_lock(udev);
-
 	temp_p = (char *)udev->scratch.data;
-
-	if (err == 0) {
-		/* try to get the interface string ! */
-		err = usbd_req_get_string_any(udev, NULL, temp_p,
-		    sizeof(udev->scratch.data),
-		    iface->idesc->iInterface);
-	}
-	if (err != 0) {
-		/* use default description */
-		usb_devinfo(udev, temp_p,
-		    sizeof(udev->scratch.data));
-	}
-
+	usb_devinfo(udev, temp_p, sizeof(udev->scratch.data));
 	if (do_unlock)
 		usbd_ctrl_unlock(udev);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401161650.40GGo98v075400>