[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-5.1 v2 42/54] hw/i386/x86: Add missing error-propagation code
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-5.1 v2 42/54] hw/i386/x86: Add missing error-propagation code |
Date: |
Mon, 6 Apr 2020 19:47:31 +0200 |
Running the coccinelle script:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --dir hw
inserted a block after object_property_set_uint("apic-id") which
calls error_propagate() and return.
Thanksfully code review noticed returning here would skip the
'object_unref(cpu)' call.
Manually fix the error propagation code by adding a label to the
existing call.
Reported-by: Peter Maydell <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/i386/x86.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index b82770024c..ec807ce94f 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -124,8 +124,12 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id,
Error **errp)
cpu = object_new(MACHINE(x86ms)->cpu_type);
object_property_set_uint(cpu, apic_id, "apic-id", &local_err);
+ if (local_err) {
+ goto out;
+ }
object_property_set_bool(cpu, true, "realized", &local_err);
+out:
object_unref(cpu);
error_propagate(errp, local_err);
}
--
2.21.1
- [PATCH-for-5.1 v2 37/54] scripts/coccinelle: Add script to catch missing error_propagate() calls, (continued)
- [PATCH-for-5.1 v2 37/54] scripts/coccinelle: Add script to catch missing error_propagate() calls, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 31/54] hw/riscv/sifive: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 39/54] hw/arm/fsl-imx: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 35/54] hw/pci-host/pnv_phb3: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 41/54] hw/dma/xilinx_axidma: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 40/54] hw/arm/stm32fx05_soc: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 38/54] hw/arm/bcm2835_peripherals: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 44/54] hw/misc/macio/macio: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 42/54] hw/i386/x86: Add missing error-propagation code,
Philippe Mathieu-Daudé <=
- [PATCH-for-5.1 v2 46/54] hw/riscv/sifive_u: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 47/54] hw/sd/milkymist-memcard: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/04/06
- [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init(), Philippe Mathieu-Daudé, 2020/04/06
- Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init(), Vladimir Sementsov-Ogievskiy, 2020/04/07
- Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init(), Philippe Mathieu-Daudé, 2020/04/07
- Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init(), Vladimir Sementsov-Ogievskiy, 2020/04/07
- Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init(), Philippe Mathieu-Daudé, 2020/04/07
- Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init(), Philippe Mathieu-Daudé, 2020/04/07
- Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init(), Vladimir Sementsov-Ogievskiy, 2020/04/07
- Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init(), Philippe Mathieu-Daudé, 2020/04/07