qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw: Simplify calls to pci_nic_init_nofail()


From: Michael Tokarev
Subject: Re: [PATCH] hw: Simplify calls to pci_nic_init_nofail()
Date: Fri, 30 Jun 2023 09:35:13 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

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 <thuth@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]