Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jan 2024 11:08:29 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e95213b35b2c - stable/14 - usb: use only usb_devinfo() in device_set_usb_desc()
Message-ID:  <202401301108.40UB8TGQ076063@gitrepo.freebsd.org>

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

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

commit e95213b35b2c0662f6cb34ea9b521f6159d78e32
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-01-16 16:49:08 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-01-30 11:07:29 +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
    
    (cherry picked from commit 45cd29412eadbb0e8c40590a94b10663addac17a)
---
 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?202401301108.40UB8TGQ076063>