qemu-devel
[Top][All Lists]
Advanced

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

[PATCH-for-5.2] acpi-build: Fix maybe-uninitialized warning when ACPI ho


From: Ani Sinha
Subject: [PATCH-for-5.2] acpi-build: Fix maybe-uninitialized warning when ACPI hotplug is off
Date: Sat, 7 Nov 2020 20:38:51 +0530

 This fixes the following warning (gcc 9.3.0 on Ubuntu):

  ../hw/i386/acpi-build.c: In function 'build_append_pci_bus_devices':
  ../hw/i386/acpi-build.c:496:9: error: 'method' may be used uninitialized
  in this function [-Werror=maybe-uninitialized]
    496 |         aml_append(parent_scope, method);
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors

Fixes: df4008c9c59 ("piix4: don't reserve hw resources when hotplug is off 
globally")
Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
 hw/i386/acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4f66642d88..79b86d4a36 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -349,7 +349,7 @@ static void build_append_pcihp_notify_entry(Aml *method, 
int slot)
 static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
                                          bool pcihp_bridge_en)
 {
-    Aml *dev, *notify_method = NULL, *method;
+    Aml *dev, *notify_method = NULL, *method = NULL;
     QObject *bsel;
     PCIBus *sec;
     int i;
@@ -492,7 +492,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, 
PCIBus *bus,
         }
     }
 
-    if (bsel || pcihp_bridge_en) {
+    if (method) {
         aml_append(parent_scope, method);
     }
     qobject_unref(bsel);
-- 
2.25.1




reply via email to

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