Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2022 19:33:27 GMT
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c093a162a2ac - stable/12 - ena: Use device_set_desc in probe
Message-ID:  <202207261933.26QJXRiA033874@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mw:

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

commit c093a162a2acf70c7ac909a9d9193255fbf2a5f6
Author:     Dawid Gorecki <dgr@semihalf.com>
AuthorDate: 2022-06-10 09:18:10 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2022-07-26 19:33:04 +0000

    ena: Use device_set_desc in probe
    
    During probe the driver created a temporary buffer to which the value of
    DEVICE_DESC constant was printed. This buffer was then copied to the
    device structure using device_set_desc_copy. Since the value of this
    string is exactly the same for every device using the ENA driver, using
    sprintf is unnecessary, and device_set_desc can be used instead.
    
    Obtained from: Semihalf
    MFC after: 2 weeks
    Sponsored by: Amazon, Inc.
    
    (cherry picked from commit 755e60ca046390bdcfc097b6a8f1a032d47a7b65)
---
 sys/dev/ena/ena.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c
index b28156ef2ab2..3a5e8c28686a 100644
--- a/sys/dev/ena/ena.c
+++ b/sys/dev/ena/ena.c
@@ -296,7 +296,6 @@ static int
 ena_probe(device_t dev)
 {
 	ena_vendor_info_t *ent;
-	char		adapter_name[60];
 	uint16_t	pci_vendor_id = 0;
 	uint16_t	pci_device_id = 0;
 
@@ -310,8 +309,7 @@ ena_probe(device_t dev)
 			ena_log_raw(DBG, "vendor=%x device=%x\n",
 			    pci_vendor_id, pci_device_id);
 
-			sprintf(adapter_name, DEVICE_DESC);
-			device_set_desc_copy(dev, adapter_name);
+			device_set_desc(dev, DEVICE_DESC);
 			return (BUS_PROBE_DEFAULT);
 		}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207261933.26QJXRiA033874>