git: da334b4f5431 - stable/14 - hidbus: Use device_set_descf()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 27 Jun 2024 15:31:09 UTC
The branch stable/14 has been updated by markj:

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

commit da334b4f5431599addb7bf88f5a7764b809422d0
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-05 19:25:05 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-27 15:27:41 +0000

    hidbus: Use device_set_descf()
    
    No functional change intended.
    
    MFC after:      1 week
    
    (cherry picked from commit 3f795763e45326489ab707c369b8daea495f6562)
---
 sys/dev/hid/hidbus.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c
index fd73136c289f..c2f8f58552e1 100644
--- a/sys/dev/hid/hidbus.c
+++ b/sys/dev/hid/hidbus.c
@@ -526,14 +526,12 @@ hidbus_set_desc(device_t child, const char *suffix)
 	struct hidbus_softc *sc = device_get_softc(bus);
 	struct hid_device_info *devinfo = device_get_ivars(bus);
 	struct hidbus_ivars *tlc = device_get_ivars(child);
-	char buf[80];
 
 	/* Do not add NULL suffix or if device name already contains it. */
 	if (suffix != NULL && strcasestr(devinfo->name, suffix) == NULL &&
-	    (sc->nauto > 1 || (tlc->flags & HIDBUS_FLAG_AUTOCHILD) == 0)) {
-		snprintf(buf, sizeof(buf), "%s %s", devinfo->name, suffix);
-		device_set_desc_copy(child, buf);
-	} else
+	    (sc->nauto > 1 || (tlc->flags & HIDBUS_FLAG_AUTOCHILD) == 0))
+		device_set_descf(child, "%s %s", devinfo->name, suffix);
+	else
 		device_set_desc(child, devinfo->name);
 }