29.06.2023 15:54, Thomas Huth пишет:
pci_nic_init_nofail() calls qemu_find_nic_model(), and this function
sets nd->model = g_strdup(default_model) if it has not been initialized
yet. So we don't have to set nd->model to the default_nic in the
calling sites.
Signed-off-by: Thomas Huth <th...@redhat.com>
---
hw/arm/sbsa-ref.c | 8 +-------
hw/arm/virt.c | 8 +-------
hw/loongarch/virt.c | 8 +-------
hw/mips/loongson3_virt.c | 8 +-------
hw/xtensa/virt.c | 8 +-------
5 files changed, 5 insertions(+), 35 deletions(-)
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index b774d80291..d8e13ddbfe 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -683,13 +683,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);
}
}
What a wonderful copy-spagetti it was :)
Applied to my trivial-patches branch, thank you!
/mjt