git: 3f795763e453 - main - hidbus: Use device_set_descf()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sun, 16 Jun 2024 20:38:01 UTC
The branch main has been updated by markj:

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

commit 3f795763e45326489ab707c369b8daea495f6562
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-05 19:25:05 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-16 20:37:26 +0000

    hidbus: Use device_set_descf()
    
    No functional change intended.
    
    MFC after:      1 week
---
 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 f50abd4b0a4d..003017c0f3ea 100644
--- a/sys/dev/hid/hidbus.c
+++ b/sys/dev/hid/hidbus.c
@@ -525,14 +525,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);
 }