From nobody Tue Jan 16 16:50:09 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TDw3k2xwrz57bZX; Tue, 16 Jan 2024 16:50:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TDw3k0NDLz4cDr; Tue, 16 Jan 2024 16:50:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705423810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Lmuhdru+5yZHVM2sNsDRKHfpKM0wrB0qB2FTcI0UYLw=; b=lkPFDXDm5yvOvIDYjwdaJkaZ3DtZP+aFdZHKZmNXrvmhVKkbluhMm9wJCV5Vtm+dtAY5Sl jH2xdRXpY3UpxSjaTKGhmImB1xpiX3LfIb29kijQupnjOd2O51KOC4YgJ+D8zRhQYth+Ds Ju9qwWDc9/Q4mr2rtRrAQ8QsP76GJ0b3CcPol0VizwGviP5UJz//ehFsz3thCHC/dygAmf ddgpNUqY/U8ayQj3vKHaGrRguRE9M8vt/baZL2ehz0LvuCEEbVQA4V27IXRZ2R05ejWM1u V/WXiXdEKMrauCa2y2m9Ttzq1E2bWyEWL0QBZpV1BL/GUR9FUPOoVLADErfSuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705423810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Lmuhdru+5yZHVM2sNsDRKHfpKM0wrB0qB2FTcI0UYLw=; b=Qpz1rQo7o8s3iRrFwdehkNTomhSmaLG/1OzjsjrC4oiO+I1yU07iBqVdhjjQ8t/q5jrfb0 oUFLTV80DvGZ9aqFZSwc6GM+Z4dMjsijihN9Xv0gNjOT6Mm3aO4jDxDDr/As7sIzyu8agE M3M3dTtEi9QhOy8wUOLybqfigTP2z1jBPJxHr/ic+3Miqm5HNq8aGyki6r19IUlh2oB4Qm AjAcgVOMpmMZ6lc7JcsVFDknwUXShTvjF8A6S+Yl6BNdPxn+qI8JDnGla/v9YH40yChzV2 +JOB6v3wim8z9CoMpwq+ZxeCHvc+0ir/cDX8Xz+9v0TFnUh5aZuIRmowEtuN7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705423810; a=rsa-sha256; cv=none; b=YRsFBVIkm012jUlRxlWvcVMZWy64a9qeNvsmQGmAE/HlZnSmkGkEIvdREuTRib6kEgSKjL rT5Ta8dJolHJ+isGacI8mmeUt2qm4Z2vUOJEZH1Z8f8nysvlRnBrh4THrTMWexTvJNXBFW 74yksdrPwfKlwvxUWWUY2MG/idlgqpmkPn/SbCjhFWIYPiSrgiwvZk7w8DjLUJoR7uL2gQ YrOfF5LZEbRoM2lIn7q+LysIJR4/nLcijqNOhA9vc8ervJfB7wqRYPcf/EDWZohNJRrZ/7 TJQhOcZIuB34Yo8o9ARD3oMaytQ2dVJ0iuvGjx9l4IBCya0QQl38AVpZhvQ8+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TDw3j6JkCznyb; Tue, 16 Jan 2024 16:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40GGo9GF075405; Tue, 16 Jan 2024 16:50:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40GGo98v075400; Tue, 16 Jan 2024 16:50:09 GMT (envelope-from git) Date: Tue, 16 Jan 2024 16:50:09 GMT Message-Id: <202401161650.40GGo98v075400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 45cd29412ead - main - usb: use only usb_devinfo() in device_set_usb_desc() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45cd29412eadbb0e8c40590a94b10663addac17a Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=45cd29412eadbb0e8c40590a94b10663addac17a commit 45cd29412eadbb0e8c40590a94b10663addac17a Author: Christos Margiolis AuthorDate: 2024-01-16 16:49:08 +0000 Commit: Christos Margiolis 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);