git: 14dbc9a4b4d4 - stable/14 - bce: Use device_set_descf()

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

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

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

    bce: Use device_set_descf()
    
    No functional change intended.
    
    MFC after:      1 week
    
    (cherry picked from commit c0bd6ec3bb2414d23f3013766b79eed51b31f696)
---
 sys/dev/bce/if_bce.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c
index 33158b75486c..2564d0c1dac6 100644
--- a/sys/dev/bce/if_bce.c
+++ b/sys/dev/bce/if_bce.c
@@ -671,7 +671,6 @@ bce_probe(device_t dev)
 {
 	const struct bce_type *t;
 	struct bce_softc *sc;
-	char *descbuf;
 	u16 vid = 0, did = 0, svid = 0, sdid = 0;
 
 	t = bce_devs;
@@ -695,19 +694,10 @@ bce_probe(device_t dev)
 		if ((vid == t->bce_vid) && (did == t->bce_did) &&
 		    ((svid == t->bce_svid) || (t->bce_svid == PCI_ANY_ID)) &&
 		    ((sdid == t->bce_sdid) || (t->bce_sdid == PCI_ANY_ID))) {
-			descbuf = malloc(BCE_DEVDESC_MAX, M_TEMP, M_NOWAIT);
-
-			if (descbuf == NULL)
-				return(ENOMEM);
-
-			/* Print out the device identity. */
-			snprintf(descbuf, BCE_DEVDESC_MAX, "%s (%c%d)",
+			device_set_descf(dev, "%s (%c%d)",
 			    t->bce_name, (((pci_read_config(dev,
 			    PCIR_REVID, 4) & 0xf0) >> 4) + 'A'),
 			    (pci_read_config(dev, PCIR_REVID, 4) & 0xf));
-
-			device_set_desc_copy(dev, descbuf);
-			free(descbuf, M_TEMP);
 			return(BUS_PROBE_DEFAULT);
 		}
 		t++;