@@ -689,13 +689,7 @@ static void create_pcie(SBSAMachineState *sms)
pci = PCI_HOST_BRIDGE(dev);
if (pci->bus) {
for (i = 0; i < nb_nics; i++) {
- NICInfo *nd = &nd_table[i];
-
- if (!nd->model) {
- nd->model = g_strdup(mc->default_nic);
- }
-
- pci_nic_init_nofail(nd, pci->bus, nd->model, NULL);
+ pci_nic_init_nofail(&nd_table[i], pci->bus, mc->default_nic, NULL);
}
}
@@ -1479,13 +1479,7 @@ static void create_pcie(VirtMachineState *vms)
vms->bus = pci->bus;
if (vms->bus) {
for (i = 0; i < nb_nics; i++) {
- NICInfo *nd = &nd_table[i];
-
- if (!nd->model) {
- nd->model = g_strdup(mc->default_nic);
- }
-
- pci_nic_init_nofail(nd, pci->bus, nd->model, NULL);
+ pci_nic_init_nofail(&nd_table[i], pci->bus, mc->default_nic, NULL);
}
}
@@ -547,13 +547,7 @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState *
/* Network init */
for (i = 0; i < nb_nics; i++) {
- NICInfo *nd = &nd_table[i];
-
- if (!nd->model) {
- nd->model = g_strdup(mc->default_nic);
- }
-
- pci_nic_init_nofail(nd, pci_bus, nd->model, NULL);
+ pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL);
}
/*
@@ -454,13 +454,7 @@ static inline void loongson3_virt_devices_init(MachineState *machine,
}
for (i = 0; i < nb_nics; i++) {
- NICInfo *nd = &nd_table[i];
-
- if (!nd->model) {
- nd->model = g_strdup(mc->default_nic);
- }
-
- pci_nic_init_nofail(nd, pci_bus, nd->model, NULL);
+ pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL);
}
}
@@ -103,13 +103,7 @@ static void create_pcie(MachineState *ms, CPUXtensaState *env, int irq_base,
pci = PCI_HOST_BRIDGE(dev);
if (pci->bus) {
for (i = 0; i < nb_nics; i++) {
- NICInfo *nd = &nd_table[i];
-
- if (!nd->model) {
- nd->model = g_strdup(mc->default_nic);
- }
-
- pci_nic_init_nofail(nd, pci->bus, nd->model, NULL);
+ pci_nic_init_nofail(&nd_table[i], pci->bus, mc->default_nic, NULL);
}
}
}