hw/i386/acpi-build: Fix maybe-uninitialized error when ACPI hotplug off
GCC 9.3.0 thinks that 'method' can be left uninitialized. This code
is already in the "if (bsel || pcihp_bridge_en)" block statement,
but it isn't smart enough to figure it out.
Restrict the code to be used only in the "if (bsel || pcihp_bridge_en)"
block statement to fix (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: df4008c9c5
("piix4: don't reserve hw resources when hotplug is off globally")
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20201108204535.2319870-4-philmd@redhat.com>
Message-Id: <20201110192316.26397-8-alex.bennee@linaro.org>
This commit is contained in:
parent
4bdccdec70
commit
811c74fb65
|
@ -465,18 +465,16 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
||||||
*/
|
*/
|
||||||
if (bsel || pcihp_bridge_en) {
|
if (bsel || pcihp_bridge_en) {
|
||||||
method = aml_method("PCNT", 0, AML_NOTSERIALIZED);
|
method = aml_method("PCNT", 0, AML_NOTSERIALIZED);
|
||||||
}
|
|
||||||
/* If bus supports hotplug select it and notify about local events */
|
/* If bus supports hotplug select it and notify about local events */
|
||||||
if (bsel) {
|
if (bsel) {
|
||||||
uint64_t bsel_val = qnum_get_uint(qobject_to(QNum, bsel));
|
uint64_t bsel_val = qnum_get_uint(qobject_to(QNum, bsel));
|
||||||
|
|
||||||
aml_append(method, aml_store(aml_int(bsel_val), aml_name("BNUM")));
|
aml_append(method, aml_store(aml_int(bsel_val), aml_name("BNUM")));
|
||||||
aml_append(method,
|
aml_append(method, aml_call2("DVNT", aml_name("PCIU"),
|
||||||
aml_call2("DVNT", aml_name("PCIU"), aml_int(1) /* Device Check */)
|
aml_int(1))); /* Device Check */
|
||||||
);
|
aml_append(method, aml_call2("DVNT", aml_name("PCID"),
|
||||||
aml_append(method,
|
aml_int(3))); /* Eject Request */
|
||||||
aml_call2("DVNT", aml_name("PCID"), aml_int(3)/* Eject Request */)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notify about child bus events in any case */
|
/* Notify about child bus events in any case */
|
||||||
|
@ -492,7 +490,6 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bsel || pcihp_bridge_en) {
|
|
||||||
aml_append(parent_scope, method);
|
aml_append(parent_scope, method);
|
||||||
}
|
}
|
||||||
qobject_unref(bsel);
|
qobject_unref(bsel);
|
||||||
|
|
Loading…
Reference in a new issue