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.
This commit is contained in:
Dawid Gorecki 2022-06-10 11:18:10 +02:00 committed by Marcin Wojtas
parent f65d7660b5
commit 755e60ca04

View file

@ -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);
}