git: c0bd6ec3bb24 - main - bce: Use device_set_descf()

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

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

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

    bce: Use device_set_descf()
    
    No functional change intended.
    
    MFC after:      1 week
---
 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++;