QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH-for-5.0 00/12] hw: Add missing error-propagation code
@ 2020-03-25 19:18 Philippe Mathieu-Daudé
  2020-03-25 19:18 ` [PATCH-for-5.0 01/12] scripts/coccinelle: Add script to catch missing error_propagate() calls Philippe Mathieu-Daudé
                   ` (13 more replies)
  0 siblings, 14 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

This series is inspired of Peter fix:
"hw/arm/xlnx-zynqmp.c: fix some error-handling code"
https://www.mail-archive.com/qemu-devel@nongnu.org/msg691636.html

Add a cocci script to fix the other places.

Based-on: <20200324134947.15384-1-peter.maydell@linaro.org>

Philippe Mathieu-Daud=C3=A9 (12):
  scripts/coccinelle: Add script to catch missing error_propagate()
    calls
  hw/arm/bcm2835_peripherals: Add missing error-propagation code
  hw/arm/fsl-imx: Add missing error-propagation code
  hw/arm/stm32fx05_soc: Add missing error-propagation code
  hw/i386/x86: Add missing error-propagation code
  hw/dma/xilinx_axidma: Add missing error-propagation code
  hw/mips/cps: Add missing error-propagation code
  hw/mips/boston: Add missing error-propagation code
  hw/mips/mips_malta: Add missing error-propagation code
  hw/misc/macio/macio: Add missing error-propagation code
  hw/net/xilinx_axienet: Add missing error-propagation code
  hw/riscv/sifive_u: Add missing error-propagation code

 ...ect_property_missing_error_propagate.cocci | 58 +++++++++++++++++++
 hw/arm/bcm2835_peripherals.c                  |  8 +++
 hw/arm/fsl-imx25.c                            |  8 +++
 hw/arm/fsl-imx6.c                             |  8 +++
 hw/arm/stm32f205_soc.c                        |  4 ++
 hw/arm/stm32f405_soc.c                        |  4 ++
 hw/dma/xilinx_axidma.c                        |  3 +
 hw/i386/x86.c                                 |  4 ++
 hw/mips/boston.c                              | 17 ++----
 hw/mips/cps.c                                 | 52 +++++++++++++++++
 hw/mips/mips_malta.c                          | 19 ++++--
 hw/misc/macio/macio.c                         |  4 ++
 hw/net/xilinx_axienet.c                       |  3 +
 hw/riscv/sifive_u.c                           |  8 +++
 14 files changed, 184 insertions(+), 16 deletions(-)
 create mode 100644 scripts/coccinelle/object_property_missing_error_propagat=
e.cocci

--=20
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 01/12] scripts/coccinelle: Add script to catch missing error_propagate() calls
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-26 21:32   ` Peter Maydell
  2020-03-25 19:18 ` [PATCH-for-5.0 02/12] hw/arm/bcm2835_peripherals: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

In some places in we put an error into a local Error*, but forget
to check for failure and pass it back to the caller.
Add a Coccinelle patch to catch automatically add the missing code.

Inspired-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 ...ect_property_missing_error_propagate.cocci | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 scripts/coccinelle/object_property_missing_error_propagate.cocci

diff --git a/scripts/coccinelle/object_property_missing_error_propagate.cocci b/scripts/coccinelle/object_property_missing_error_propagate.cocci
new file mode 100644
index 0000000000..104e345273
--- /dev/null
+++ b/scripts/coccinelle/object_property_missing_error_propagate.cocci
@@ -0,0 +1,58 @@
+// Add missing error-propagation code
+//
+// Copyright: (C) 2020 Philippe Mathieu-Daudé.
+// This work is licensed under the terms of the GNU GPLv2 or later.
+//
+// spatch \
+//  --macro-file scripts/cocci-macro-file.h --include-headers \
+//  --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
+//  --keep-comments --smpl-spacing --in-place --dir hw
+//
+// Inspired by https://www.mail-archive.com/qemu-devel@nongnu.org/msg691638.html
+
+@match exists@
+typedef Error;
+Error *err;
+identifier func, errp;
+identifier object_property_set_type1 =~ "^object_property_set_.*";
+identifier object_property_set_type2 =~ "^object_property_set_.*";
+expression obj;
+@@
+void func(..., Error **errp)
+{
+ <+...
+ object_property_set_type1(obj, ..., &err);
+ ... when != err
+ object_property_set_type2(obj, ..., &err);
+ ...+>
+}
+
+@@
+Error *match.err;
+identifier match.errp;
+identifier match.object_property_set_type1;
+expression match.obj;
+@@
+ object_property_set_type1(obj, ..., &err);
++if (err) {
++    error_propagate(errp, err);
++    return;
++}
+
+@manual depends on never match@
+Error *err;
+identifier object_property_set_type1 =~ "^object_property_set_.*";
+identifier object_property_set_type2 =~ "^object_property_set_.*";
+position p;
+@@
+ object_property_set_type1@p(..., &err);
+ ... when != err
+ object_property_set_type2(..., &err);
+
+@script:python@
+f << manual.object_property_set_type1;
+p << manual.p;
+@@
+print("[[manual check required: "
+      "error_propagate() might be missing in {}() {}:{}:{}]]".format(
+            f, p[0].file, p[0].line, p[0].column))
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 02/12] hw/arm/bcm2835_peripherals: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
  2020-03-25 19:18 ` [PATCH-for-5.0 01/12] scripts/coccinelle: Add script to catch missing error_propagate() calls Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-26 21:34   ` Peter Maydell
  2020-03-25 19:18 ` [PATCH-for-5.0 03/12] hw/arm/fsl-imx: " Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Patch created mechanically by running:

  $ spatch \
    --macro-file scripts/cocci-macro-file.h --include-headers \
    --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
    --keep-comments --smpl-spacing --in-place --dir hw

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/arm/bcm2835_peripherals.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
index edcaa4916d..a111e91069 100644
--- a/hw/arm/bcm2835_peripherals.c
+++ b/hw/arm/bcm2835_peripherals.c
@@ -133,254 +133,262 @@ static void bcm2835_peripherals_init(Object *obj)
 static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
 {
     BCM2835PeripheralState *s = BCM2835_PERIPHERALS(dev);
     Object *obj;
     MemoryRegion *ram;
     Error *err = NULL;
     uint64_t ram_size, vcram_size;
     int n;
 
     obj = object_property_get_link(OBJECT(dev), "ram", &err);
     if (obj == NULL) {
         error_setg(errp, "%s: required ram link not found: %s",
                    __func__, error_get_pretty(err));
         return;
     }
 
     ram = MEMORY_REGION(obj);
     ram_size = memory_region_size(ram);
 
     /* Map peripherals and RAM into the GPU address space. */
     memory_region_init_alias(&s->peri_mr_alias, OBJECT(s),
                              "bcm2835-peripherals", &s->peri_mr, 0,
                              memory_region_size(&s->peri_mr));
 
     memory_region_add_subregion_overlap(&s->gpu_bus_mr, BCM2835_VC_PERI_BASE,
                                         &s->peri_mr_alias, 1);
 
     /* RAM is aliased four times (different cache configurations) on the GPU */
     for (n = 0; n < 4; n++) {
         memory_region_init_alias(&s->ram_alias[n], OBJECT(s),
                                  "bcm2835-gpu-ram-alias[*]", ram, 0, ram_size);
         memory_region_add_subregion_overlap(&s->gpu_bus_mr, (hwaddr)n << 30,
                                             &s->ram_alias[n], 0);
     }
 
     /* Interrupt Controller */
     object_property_set_bool(OBJECT(&s->ic), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->peri_mr, ARMCTRL_IC_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ic), 0));
     sysbus_pass_irq(SYS_BUS_DEVICE(s), SYS_BUS_DEVICE(&s->ic));
 
     /* Sys Timer */
     object_property_set_bool(OBJECT(&s->systmr), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     memory_region_add_subregion(&s->peri_mr, ST_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->systmr), 0));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->systmr), 0,
         qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_ARM_IRQ,
                                INTERRUPT_ARM_TIMER));
 
     /* UART0 */
     qdev_prop_set_chr(DEVICE(&s->uart0), "chardev", serial_hd(0));
     object_property_set_bool(OBJECT(&s->uart0), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->peri_mr, UART0_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart0), 0));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart0), 0,
         qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
                                INTERRUPT_UART0));
 
     /* AUX / UART1 */
     qdev_prop_set_chr(DEVICE(&s->aux), "chardev", serial_hd(1));
 
     object_property_set_bool(OBJECT(&s->aux), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->peri_mr, AUX_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->aux), 0));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->aux), 0,
         qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
                                INTERRUPT_AUX));
 
     /* Mailboxes */
     object_property_set_bool(OBJECT(&s->mboxes), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->peri_mr, ARMCTRL_0_SBM_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mboxes), 0));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->mboxes), 0,
         qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_ARM_IRQ,
                                INTERRUPT_ARM_MAILBOX));
 
     /* Framebuffer */
     vcram_size = object_property_get_uint(OBJECT(s), "vcram-size", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     object_property_set_uint(OBJECT(&s->fb), ram_size - vcram_size,
                              "vcram-base", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     object_property_set_bool(OBJECT(&s->fb), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->mbox_mr, MBOX_CHAN_FB << MBOX_AS_CHAN_SHIFT,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->fb), 0));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->fb), 0,
                        qdev_get_gpio_in(DEVICE(&s->mboxes), MBOX_CHAN_FB));
 
     /* Property channel */
     object_property_set_bool(OBJECT(&s->property), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->mbox_mr,
                 MBOX_CHAN_PROPERTY << MBOX_AS_CHAN_SHIFT,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->property), 0));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->property), 0,
                       qdev_get_gpio_in(DEVICE(&s->mboxes), MBOX_CHAN_PROPERTY));
 
     /* Random Number Generator */
     object_property_set_bool(OBJECT(&s->rng), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->peri_mr, RNG_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rng), 0));
 
     /* Extended Mass Media Controller
      *
      * Compatible with:
      * - SD Host Controller Specification Version 3.0 Draft 1.0
      * - SDIO Specification Version 3.0
      * - MMC Specification Version 4.4
      *
      * For the exact details please refer to the Arasan documentation:
      *   SD3.0_Host_AHB_eMMC4.4_Usersguide_ver5.9_jan11_10.pdf
      */
     object_property_set_uint(OBJECT(&s->sdhci), 3, "sd-spec-version", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_uint(OBJECT(&s->sdhci), BCM2835_SDHC_CAPAREG, "capareg",
                              &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_bool(OBJECT(&s->sdhci), true, "pending-insert-quirk",
                              &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     object_property_set_bool(OBJECT(&s->sdhci), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->peri_mr, EMMC1_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sdhci), 0));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci), 0,
         qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
                                INTERRUPT_ARASANSDIO));
 
     /* SDHOST */
     object_property_set_bool(OBJECT(&s->sdhost), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->peri_mr, MMCI0_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sdhost), 0));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhost), 0,
         qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ,
                                INTERRUPT_SDIO));
 
     /* DMA Channels */
     object_property_set_bool(OBJECT(&s->dma), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->peri_mr, DMA_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->dma), 0));
     memory_region_add_subregion(&s->peri_mr, DMA15_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->dma), 1));
 
     for (n = 0; n <= 12; n++) {
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->dma), n,
                            qdev_get_gpio_in_named(DEVICE(&s->ic),
                                                   BCM2835_IC_GPU_IRQ,
                                                   INTERRUPT_DMA0 + n));
     }
 
     /* THERMAL */
     object_property_set_bool(OBJECT(&s->thermal), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     memory_region_add_subregion(&s->peri_mr, THERMAL_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->thermal), 0));
 
     /* GPIO */
     object_property_set_bool(OBJECT(&s->gpio), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->peri_mr, GPIO_OFFSET,
                 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0));
 
     object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(&s->gpio), "sd-bus",
                               &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     create_unimp(s, &s->armtmr, "bcm2835-sp804", ARMCTRL_TIMER0_1_OFFSET, 0x40);
     create_unimp(s, &s->cprman, "bcm2835-cprman", CPRMAN_OFFSET, 0x1000);
     create_unimp(s, &s->a2w, "bcm2835-a2w", A2W_OFFSET, 0x1000);
     create_unimp(s, &s->i2s, "bcm2835-i2s", I2S_OFFSET, 0x100);
     create_unimp(s, &s->smi, "bcm2835-smi", SMI_OFFSET, 0x100);
     create_unimp(s, &s->spi[0], "bcm2835-spi0", SPI0_OFFSET, 0x20);
     create_unimp(s, &s->bscsl, "bcm2835-spis", BSC_SL_OFFSET, 0x100);
     create_unimp(s, &s->i2c[0], "bcm2835-i2c0", BSC0_OFFSET, 0x20);
     create_unimp(s, &s->i2c[1], "bcm2835-i2c1", BSC1_OFFSET, 0x20);
     create_unimp(s, &s->i2c[2], "bcm2835-i2c2", BSC2_OFFSET, 0x20);
     create_unimp(s, &s->otp, "bcm2835-otp", OTP_OFFSET, 0x80);
     create_unimp(s, &s->dbus, "bcm2835-dbus", DBUS_OFFSET, 0x8000);
     create_unimp(s, &s->ave0, "bcm2835-ave0", AVE0_OFFSET, 0x8000);
     create_unimp(s, &s->dwc2, "dwc-usb2", USB_OTG_OFFSET, 0x1000);
     create_unimp(s, &s->sdramc, "bcm2835-sdramc", SDRAMC_OFFSET, 0x100);
 }
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 03/12] hw/arm/fsl-imx: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
  2020-03-25 19:18 ` [PATCH-for-5.0 01/12] scripts/coccinelle: Add script to catch missing error_propagate() calls Philippe Mathieu-Daudé
  2020-03-25 19:18 ` [PATCH-for-5.0 02/12] hw/arm/bcm2835_peripherals: Add missing error-propagation code Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-26 21:35   ` Peter Maydell
  2020-03-25 19:18 ` [PATCH-for-5.0 04/12] hw/arm/stm32fx05_soc: " Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Patch created mechanically by running:

  $ spatch \
    --macro-file scripts/cocci-macro-file.h --include-headers \
    --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
    --keep-comments --smpl-spacing --in-place --dir hw

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/arm/fsl-imx25.c | 8 ++++++++
 hw/arm/fsl-imx6.c  | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
index 6f1a82ce3d..c915a2106d 100644
--- a/hw/arm/fsl-imx25.c
+++ b/hw/arm/fsl-imx25.c
@@ -92,247 +92,255 @@ static void fsl_imx25_init(Object *obj)
 static void fsl_imx25_realize(DeviceState *dev, Error **errp)
 {
     FslIMX25State *s = FSL_IMX25(dev);
     uint8_t i;
     Error *err = NULL;
 
     object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     object_property_set_bool(OBJECT(&s->avic), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->avic), 0, FSL_IMX25_AVIC_ADDR);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->avic), 0,
                        qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->avic), 1,
                        qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ));
 
     object_property_set_bool(OBJECT(&s->ccm), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccm), 0, FSL_IMX25_CCM_ADDR);
 
     /* Initialize all UARTs */
     for (i = 0; i < FSL_IMX25_NUM_UARTS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } serial_table[FSL_IMX25_NUM_UARTS] = {
             { FSL_IMX25_UART1_ADDR, FSL_IMX25_UART1_IRQ },
             { FSL_IMX25_UART2_ADDR, FSL_IMX25_UART2_IRQ },
             { FSL_IMX25_UART3_ADDR, FSL_IMX25_UART3_IRQ },
             { FSL_IMX25_UART4_ADDR, FSL_IMX25_UART4_IRQ },
             { FSL_IMX25_UART5_ADDR, FSL_IMX25_UART5_IRQ }
         };
 
         qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hd(i));
 
         object_property_set_bool(OBJECT(&s->uart[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, serial_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->avic),
                                             serial_table[i].irq));
     }
 
     /* Initialize all GPT timers */
     for (i = 0; i < FSL_IMX25_NUM_GPTS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } gpt_table[FSL_IMX25_NUM_GPTS] = {
             { FSL_IMX25_GPT1_ADDR, FSL_IMX25_GPT1_IRQ },
             { FSL_IMX25_GPT2_ADDR, FSL_IMX25_GPT2_IRQ },
             { FSL_IMX25_GPT3_ADDR, FSL_IMX25_GPT3_IRQ },
             { FSL_IMX25_GPT4_ADDR, FSL_IMX25_GPT4_IRQ }
         };
 
         s->gpt[i].ccm = IMX_CCM(&s->ccm);
 
         object_property_set_bool(OBJECT(&s->gpt[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt[i]), 0, gpt_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->avic),
                                             gpt_table[i].irq));
     }
 
     /* Initialize all EPIT timers */
     for (i = 0; i < FSL_IMX25_NUM_EPITS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } epit_table[FSL_IMX25_NUM_EPITS] = {
             { FSL_IMX25_EPIT1_ADDR, FSL_IMX25_EPIT1_IRQ },
             { FSL_IMX25_EPIT2_ADDR, FSL_IMX25_EPIT2_IRQ }
         };
 
         s->epit[i].ccm = IMX_CCM(&s->ccm);
 
         object_property_set_bool(OBJECT(&s->epit[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->epit[i]), 0, epit_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->avic),
                                             epit_table[i].irq));
     }
 
     qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]);
 
     object_property_set_bool(OBJECT(&s->fec), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->fec), 0, FSL_IMX25_FEC_ADDR);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->fec), 0,
                        qdev_get_gpio_in(DEVICE(&s->avic), FSL_IMX25_FEC_IRQ));
 
     object_property_set_bool(OBJECT(&s->rngc), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->rngc), 0, FSL_IMX25_RNGC_ADDR);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->rngc), 0,
                        qdev_get_gpio_in(DEVICE(&s->avic), FSL_IMX25_RNGC_IRQ));
 
     /* Initialize all I2C */
     for (i = 0; i < FSL_IMX25_NUM_I2CS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } i2c_table[FSL_IMX25_NUM_I2CS] = {
             { FSL_IMX25_I2C1_ADDR, FSL_IMX25_I2C1_IRQ },
             { FSL_IMX25_I2C2_ADDR, FSL_IMX25_I2C2_IRQ },
             { FSL_IMX25_I2C3_ADDR, FSL_IMX25_I2C3_IRQ }
         };
 
         object_property_set_bool(OBJECT(&s->i2c[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, i2c_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->avic),
                                             i2c_table[i].irq));
     }
 
     /* Initialize all GPIOs */
     for (i = 0; i < FSL_IMX25_NUM_GPIOS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } gpio_table[FSL_IMX25_NUM_GPIOS] = {
             { FSL_IMX25_GPIO1_ADDR, FSL_IMX25_GPIO1_IRQ },
             { FSL_IMX25_GPIO2_ADDR, FSL_IMX25_GPIO2_IRQ },
             { FSL_IMX25_GPIO3_ADDR, FSL_IMX25_GPIO3_IRQ },
             { FSL_IMX25_GPIO4_ADDR, FSL_IMX25_GPIO4_IRQ }
         };
 
         object_property_set_bool(OBJECT(&s->gpio[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, gpio_table[i].addr);
         /* Connect GPIO IRQ to PIC */
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->avic),
                                             gpio_table[i].irq));
     }
 
     /* Initialize all SDHC */
     for (i = 0; i < FSL_IMX25_NUM_ESDHCS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } esdhc_table[FSL_IMX25_NUM_ESDHCS] = {
             { FSL_IMX25_ESDHC1_ADDR, FSL_IMX25_ESDHC1_IRQ },
             { FSL_IMX25_ESDHC2_ADDR, FSL_IMX25_ESDHC2_IRQ },
         };
 
         object_property_set_uint(OBJECT(&s->esdhc[i]), 2, "sd-spec-version",
                                  &err);
+        if (err) {
+            error_propagate(errp, err);
+            return;
+        }
         object_property_set_uint(OBJECT(&s->esdhc[i]), IMX25_ESDHC_CAPABILITIES,
                                  "capareg", &err);
+        if (err) {
+            error_propagate(errp, err);
+            return;
+        }
         object_property_set_bool(OBJECT(&s->esdhc[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->esdhc[i]), 0, esdhc_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->esdhc[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->avic),
                                             esdhc_table[i].irq));
     }
 
     /* USB */
     for (i = 0; i < FSL_IMX25_NUM_USBS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } usb_table[FSL_IMX25_NUM_USBS] = {
             { FSL_IMX25_USB1_ADDR, FSL_IMX25_USB1_IRQ },
             { FSL_IMX25_USB2_ADDR, FSL_IMX25_USB2_IRQ },
         };
 
         object_property_set_bool(OBJECT(&s->usb[i]), true, "realized",
                                  &error_abort);
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0, usb_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->avic),
                                             usb_table[i].irq));
     }
 
     /* initialize 2 x 16 KB ROM */
     memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0",
                            FSL_IMX25_ROM0_SIZE, &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM0_ADDR,
                                 &s->rom[0]);
     memory_region_init_rom(&s->rom[1], OBJECT(dev), "imx25.rom1",
                            FSL_IMX25_ROM1_SIZE, &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM1_ADDR,
                                 &s->rom[1]);
 
     /* initialize internal RAM (128 KB) */
     memory_region_init_ram(&s->iram, NULL, "imx25.iram", FSL_IMX25_IRAM_SIZE,
                            &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     memory_region_add_subregion(get_system_memory(), FSL_IMX25_IRAM_ADDR,
                                 &s->iram);
 
     /* internal RAM (128 KB) is aliased over 128 MB - 128 KB */
     memory_region_init_alias(&s->iram_alias, OBJECT(dev), "imx25.iram_alias",
                              &s->iram, 0, FSL_IMX25_IRAM_ALIAS_SIZE);
     memory_region_add_subregion(get_system_memory(), FSL_IMX25_IRAM_ALIAS_ADDR,
                                 &s->iram_alias);
 }
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
index 13f1bf23a6..71b2729298 100644
--- a/hw/arm/fsl-imx6.c
+++ b/hw/arm/fsl-imx6.c
@@ -116,363 +116,371 @@ static void fsl_imx6_init(Object *obj)
 static void fsl_imx6_realize(DeviceState *dev, Error **errp)
 {
     MachineState *ms = MACHINE(qdev_get_machine());
     FslIMX6State *s = FSL_IMX6(dev);
     uint16_t i;
     Error *err = NULL;
     unsigned int smp_cpus = ms->smp.cpus;
 
     if (smp_cpus > FSL_IMX6_NUM_CPUS) {
         error_setg(errp, "%s: Only %d CPUs are supported (%d requested)",
                    TYPE_FSL_IMX6, FSL_IMX6_NUM_CPUS, smp_cpus);
         return;
     }
 
     for (i = 0; i < smp_cpus; i++) {
 
         /* On uniprocessor, the CBAR is set to 0 */
         if (smp_cpus > 1) {
             object_property_set_int(OBJECT(&s->cpu[i]), FSL_IMX6_A9MPCORE_ADDR,
                                     "reset-cbar", &error_abort);
         }
 
         /* All CPU but CPU 0 start in power off mode */
         if (i) {
             object_property_set_bool(OBJECT(&s->cpu[i]), true,
                                      "start-powered-off", &error_abort);
         }
 
         object_property_set_bool(OBJECT(&s->cpu[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
     }
 
     object_property_set_int(OBJECT(&s->a9mpcore), smp_cpus, "num-cpu",
                             &error_abort);
 
     object_property_set_int(OBJECT(&s->a9mpcore),
                             FSL_IMX6_MAX_IRQ + GIC_INTERNAL, "num-irq",
                             &error_abort);
 
     object_property_set_bool(OBJECT(&s->a9mpcore), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->a9mpcore), 0, FSL_IMX6_A9MPCORE_ADDR);
 
     for (i = 0; i < smp_cpus; i++) {
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->a9mpcore), i,
                            qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_IRQ));
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->a9mpcore), i + smp_cpus,
                            qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_FIQ));
     }
 
     object_property_set_bool(OBJECT(&s->ccm), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccm), 0, FSL_IMX6_CCM_ADDR);
 
     object_property_set_bool(OBJECT(&s->src), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->src), 0, FSL_IMX6_SRC_ADDR);
 
     /* Initialize all UARTs */
     for (i = 0; i < FSL_IMX6_NUM_UARTS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } serial_table[FSL_IMX6_NUM_UARTS] = {
             { FSL_IMX6_UART1_ADDR, FSL_IMX6_UART1_IRQ },
             { FSL_IMX6_UART2_ADDR, FSL_IMX6_UART2_IRQ },
             { FSL_IMX6_UART3_ADDR, FSL_IMX6_UART3_IRQ },
             { FSL_IMX6_UART4_ADDR, FSL_IMX6_UART4_IRQ },
             { FSL_IMX6_UART5_ADDR, FSL_IMX6_UART5_IRQ },
         };
 
         qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", serial_hd(i));
 
         object_property_set_bool(OBJECT(&s->uart[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, serial_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                             serial_table[i].irq));
     }
 
     s->gpt.ccm = IMX_CCM(&s->ccm);
 
     object_property_set_bool(OBJECT(&s->gpt), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt), 0, FSL_IMX6_GPT_ADDR);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt), 0,
                        qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                         FSL_IMX6_GPT_IRQ));
 
     /* Initialize all EPIT timers */
     for (i = 0; i < FSL_IMX6_NUM_EPITS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } epit_table[FSL_IMX6_NUM_EPITS] = {
             { FSL_IMX6_EPIT1_ADDR, FSL_IMX6_EPIT1_IRQ },
             { FSL_IMX6_EPIT2_ADDR, FSL_IMX6_EPIT2_IRQ },
         };
 
         s->epit[i].ccm = IMX_CCM(&s->ccm);
 
         object_property_set_bool(OBJECT(&s->epit[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->epit[i]), 0, epit_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                             epit_table[i].irq));
     }
 
     /* Initialize all I2C */
     for (i = 0; i < FSL_IMX6_NUM_I2CS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } i2c_table[FSL_IMX6_NUM_I2CS] = {
             { FSL_IMX6_I2C1_ADDR, FSL_IMX6_I2C1_IRQ },
             { FSL_IMX6_I2C2_ADDR, FSL_IMX6_I2C2_IRQ },
             { FSL_IMX6_I2C3_ADDR, FSL_IMX6_I2C3_IRQ }
         };
 
         object_property_set_bool(OBJECT(&s->i2c[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, i2c_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                             i2c_table[i].irq));
     }
 
     /* Initialize all GPIOs */
     for (i = 0; i < FSL_IMX6_NUM_GPIOS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq_low;
             unsigned int irq_high;
         } gpio_table[FSL_IMX6_NUM_GPIOS] = {
             {
                 FSL_IMX6_GPIO1_ADDR,
                 FSL_IMX6_GPIO1_LOW_IRQ,
                 FSL_IMX6_GPIO1_HIGH_IRQ
             },
             {
                 FSL_IMX6_GPIO2_ADDR,
                 FSL_IMX6_GPIO2_LOW_IRQ,
                 FSL_IMX6_GPIO2_HIGH_IRQ
             },
             {
                 FSL_IMX6_GPIO3_ADDR,
                 FSL_IMX6_GPIO3_LOW_IRQ,
                 FSL_IMX6_GPIO3_HIGH_IRQ
             },
             {
                 FSL_IMX6_GPIO4_ADDR,
                 FSL_IMX6_GPIO4_LOW_IRQ,
                 FSL_IMX6_GPIO4_HIGH_IRQ
             },
             {
                 FSL_IMX6_GPIO5_ADDR,
                 FSL_IMX6_GPIO5_LOW_IRQ,
                 FSL_IMX6_GPIO5_HIGH_IRQ
             },
             {
                 FSL_IMX6_GPIO6_ADDR,
                 FSL_IMX6_GPIO6_LOW_IRQ,
                 FSL_IMX6_GPIO6_HIGH_IRQ
             },
             {
                 FSL_IMX6_GPIO7_ADDR,
                 FSL_IMX6_GPIO7_LOW_IRQ,
                 FSL_IMX6_GPIO7_HIGH_IRQ
             },
         };
 
         object_property_set_bool(OBJECT(&s->gpio[i]), true, "has-edge-sel",
                                  &error_abort);
         object_property_set_bool(OBJECT(&s->gpio[i]), true, "has-upper-pin-irq",
                                  &error_abort);
         object_property_set_bool(OBJECT(&s->gpio[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, gpio_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                             gpio_table[i].irq_low));
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1,
                            qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                             gpio_table[i].irq_high));
     }
 
     /* Initialize all SDHC */
     for (i = 0; i < FSL_IMX6_NUM_ESDHCS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } esdhc_table[FSL_IMX6_NUM_ESDHCS] = {
             { FSL_IMX6_uSDHC1_ADDR, FSL_IMX6_uSDHC1_IRQ },
             { FSL_IMX6_uSDHC2_ADDR, FSL_IMX6_uSDHC2_IRQ },
             { FSL_IMX6_uSDHC3_ADDR, FSL_IMX6_uSDHC3_IRQ },
             { FSL_IMX6_uSDHC4_ADDR, FSL_IMX6_uSDHC4_IRQ },
         };
 
         /* UHS-I SDIO3.0 SDR104 1.8V ADMA */
         object_property_set_uint(OBJECT(&s->esdhc[i]), 3, "sd-spec-version",
                                  &err);
+        if (err) {
+            error_propagate(errp, err);
+            return;
+        }
         object_property_set_uint(OBJECT(&s->esdhc[i]), IMX6_ESDHC_CAPABILITIES,
                                  "capareg", &err);
+        if (err) {
+            error_propagate(errp, err);
+            return;
+        }
         object_property_set_bool(OBJECT(&s->esdhc[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->esdhc[i]), 0, esdhc_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->esdhc[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                             esdhc_table[i].irq));
     }
 
     /* USB */
     for (i = 0; i < FSL_IMX6_NUM_USB_PHYS; i++) {
         object_property_set_bool(OBJECT(&s->usbphy[i]), true, "realized",
                                  &error_abort);
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->usbphy[i]), 0,
                         FSL_IMX6_USBPHY1_ADDR + i * 0x1000);
     }
     for (i = 0; i < FSL_IMX6_NUM_USBS; i++) {
         static const int FSL_IMX6_USBn_IRQ[] = {
             FSL_IMX6_USB_OTG_IRQ,
             FSL_IMX6_USB_HOST1_IRQ,
             FSL_IMX6_USB_HOST2_IRQ,
             FSL_IMX6_USB_HOST3_IRQ,
         };
 
         object_property_set_bool(OBJECT(&s->usb[i]), true, "realized",
                                  &error_abort);
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0,
                         FSL_IMX6_USBOH3_USB_ADDR + i * 0x200);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                             FSL_IMX6_USBn_IRQ[i]));
     }
 
     /* Initialize all ECSPI */
     for (i = 0; i < FSL_IMX6_NUM_ECSPIS; i++) {
         static const struct {
             hwaddr addr;
             unsigned int irq;
         } spi_table[FSL_IMX6_NUM_ECSPIS] = {
             { FSL_IMX6_eCSPI1_ADDR, FSL_IMX6_ECSPI1_IRQ },
             { FSL_IMX6_eCSPI2_ADDR, FSL_IMX6_ECSPI2_IRQ },
             { FSL_IMX6_eCSPI3_ADDR, FSL_IMX6_ECSPI3_IRQ },
             { FSL_IMX6_eCSPI4_ADDR, FSL_IMX6_ECSPI4_IRQ },
             { FSL_IMX6_eCSPI5_ADDR, FSL_IMX6_ECSPI5_IRQ },
         };
 
         /* Initialize the SPI */
         object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_table[i].addr);
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,
                            qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                             spi_table[i].irq));
     }
 
     qdev_set_nic_properties(DEVICE(&s->eth), &nd_table[0]);
     object_property_set_bool(OBJECT(&s->eth), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth), 0, FSL_IMX6_ENET_ADDR);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth), 0,
                        qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                         FSL_IMX6_ENET_MAC_IRQ));
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth), 1,
                        qdev_get_gpio_in(DEVICE(&s->a9mpcore),
                                         FSL_IMX6_ENET_MAC_1588_IRQ));
 
     /*
      * Watchdog
      */
     for (i = 0; i < FSL_IMX6_NUM_WDTS; i++) {
         static const hwaddr FSL_IMX6_WDOGn_ADDR[FSL_IMX6_NUM_WDTS] = {
             FSL_IMX6_WDOG1_ADDR,
             FSL_IMX6_WDOG2_ADDR,
         };
 
         object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
                                  &error_abort);
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX6_WDOGn_ADDR[i]);
     }
 
     /* ROM memory */
     memory_region_init_rom(&s->rom, OBJECT(dev), "imx6.rom",
                            FSL_IMX6_ROM_SIZE, &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     memory_region_add_subregion(get_system_memory(), FSL_IMX6_ROM_ADDR,
                                 &s->rom);
 
     /* CAAM memory */
     memory_region_init_rom(&s->caam, OBJECT(dev), "imx6.caam",
                            FSL_IMX6_CAAM_MEM_SIZE, &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     memory_region_add_subregion(get_system_memory(), FSL_IMX6_CAAM_MEM_ADDR,
                                 &s->caam);
 
     /* OCRAM memory */
     memory_region_init_ram(&s->ocram, NULL, "imx6.ocram", FSL_IMX6_OCRAM_SIZE,
                            &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     memory_region_add_subregion(get_system_memory(), FSL_IMX6_OCRAM_ADDR,
                                 &s->ocram);
 
     /* internal OCRAM (256 KB) is aliased over 1 MB */
     memory_region_init_alias(&s->ocram_alias, OBJECT(dev), "imx6.ocram_alias",
                              &s->ocram, 0, FSL_IMX6_OCRAM_ALIAS_SIZE);
     memory_region_add_subregion(get_system_memory(), FSL_IMX6_OCRAM_ALIAS_ADDR,
                                 &s->ocram_alias);
 }
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 04/12] hw/arm/stm32fx05_soc: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 03/12] hw/arm/fsl-imx: " Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-25 20:51   ` Alistair Francis
  2020-03-26 21:45   ` Peter Maydell
  2020-03-25 19:18 ` [PATCH-for-5.0 05/12] hw/i386/x86: " Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  13 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Patch created mechanically by running:

  $ spatch \
    --macro-file scripts/cocci-macro-file.h --include-headers \
    --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
    --keep-comments --smpl-spacing --in-place --dir hw

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/arm/stm32f205_soc.c | 4 ++++
 hw/arm/stm32f405_soc.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
index 118c342559..1d80f91dd7 100644
--- a/hw/arm/stm32f205_soc.c
+++ b/hw/arm/stm32f205_soc.c
@@ -83,113 +83,117 @@ static void stm32f205_soc_initfn(Object *obj)
 static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
 {
     STM32F205State *s = STM32F205_SOC(dev_soc);
     DeviceState *dev, *armv7m;
     SysBusDevice *busdev;
     Error *err = NULL;
     int i;
 
     MemoryRegion *system_memory = get_system_memory();
     MemoryRegion *sram = g_new(MemoryRegion, 1);
     MemoryRegion *flash = g_new(MemoryRegion, 1);
     MemoryRegion *flash_alias = g_new(MemoryRegion, 1);
 
     memory_region_init_rom(flash, OBJECT(dev_soc), "STM32F205.flash",
                            FLASH_SIZE, &error_fatal);
     memory_region_init_alias(flash_alias, OBJECT(dev_soc),
                              "STM32F205.flash.alias", flash, 0, FLASH_SIZE);
 
     memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash);
     memory_region_add_subregion(system_memory, 0, flash_alias);
 
     memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE,
                            &error_fatal);
     memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram);
 
     armv7m = DEVICE(&s->armv7m);
     qdev_prop_set_uint32(armv7m, "num-irq", 96);
     qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type);
     qdev_prop_set_bit(armv7m, "enable-bitband", true);
     object_property_set_link(OBJECT(&s->armv7m), OBJECT(get_system_memory()),
                                      "memory", &error_abort);
     object_property_set_bool(OBJECT(&s->armv7m), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
 
     /* System configuration controller */
     dev = DEVICE(&s->syscfg);
     object_property_set_bool(OBJECT(&s->syscfg), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
     busdev = SYS_BUS_DEVICE(dev);
     sysbus_mmio_map(busdev, 0, 0x40013800);
     sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, 71));
 
     /* Attach UART (uses USART registers) and USART controllers */
     for (i = 0; i < STM_NUM_USARTS; i++) {
         dev = DEVICE(&(s->usart[i]));
         qdev_prop_set_chr(dev, "chardev", serial_hd(i));
         object_property_set_bool(OBJECT(&s->usart[i]), true, "realized", &err);
         if (err != NULL) {
             error_propagate(errp, err);
             return;
         }
         busdev = SYS_BUS_DEVICE(dev);
         sysbus_mmio_map(busdev, 0, usart_addr[i]);
         sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, usart_irq[i]));
     }
 
     /* Timer 2 to 5 */
     for (i = 0; i < STM_NUM_TIMERS; i++) {
         dev = DEVICE(&(s->timer[i]));
         qdev_prop_set_uint64(dev, "clock-frequency", 1000000000);
         object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err);
         if (err != NULL) {
             error_propagate(errp, err);
             return;
         }
         busdev = SYS_BUS_DEVICE(dev);
         sysbus_mmio_map(busdev, 0, timer_addr[i]);
         sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, timer_irq[i]));
     }
 
     /* ADC 1 to 3 */
     object_property_set_int(OBJECT(s->adc_irqs), STM_NUM_ADCS,
                             "num-lines", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_bool(OBJECT(s->adc_irqs), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
     qdev_connect_gpio_out(DEVICE(s->adc_irqs), 0,
                           qdev_get_gpio_in(armv7m, ADC_IRQ));
 
     for (i = 0; i < STM_NUM_ADCS; i++) {
         dev = DEVICE(&(s->adc[i]));
         object_property_set_bool(OBJECT(&s->adc[i]), true, "realized", &err);
         if (err != NULL) {
             error_propagate(errp, err);
             return;
         }
         busdev = SYS_BUS_DEVICE(dev);
         sysbus_mmio_map(busdev, 0, adc_addr[i]);
         sysbus_connect_irq(busdev, 0,
                            qdev_get_gpio_in(DEVICE(s->adc_irqs), i));
     }
 
     /* SPI 1 and 2 */
     for (i = 0; i < STM_NUM_SPIS; i++) {
         dev = DEVICE(&(s->spi[i]));
         object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err);
         if (err != NULL) {
             error_propagate(errp, err);
             return;
         }
         busdev = SYS_BUS_DEVICE(dev);
         sysbus_mmio_map(busdev, 0, spi_addr[i]);
         sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, spi_irq[i]));
     }
 }
diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c
index 4f10ce6176..398a3b5b4f 100644
--- a/hw/arm/stm32f405_soc.c
+++ b/hw/arm/stm32f405_soc.c
@@ -89,183 +89,187 @@ static void stm32f405_soc_initfn(Object *obj)
 static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp)
 {
     STM32F405State *s = STM32F405_SOC(dev_soc);
     MemoryRegion *system_memory = get_system_memory();
     DeviceState *dev, *armv7m;
     SysBusDevice *busdev;
     Error *err = NULL;
     int i;
 
     memory_region_init_rom(&s->flash, OBJECT(dev_soc), "STM32F405.flash",
                            FLASH_SIZE, &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
     memory_region_init_alias(&s->flash_alias, OBJECT(dev_soc),
                              "STM32F405.flash.alias", &s->flash, 0,
                              FLASH_SIZE);
 
     memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->flash);
     memory_region_add_subregion(system_memory, 0, &s->flash_alias);
 
     memory_region_init_ram(&s->sram, NULL, "STM32F405.sram", SRAM_SIZE,
                            &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
     memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, &s->sram);
 
     armv7m = DEVICE(&s->armv7m);
     qdev_prop_set_uint32(armv7m, "num-irq", 96);
     qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type);
     qdev_prop_set_bit(armv7m, "enable-bitband", true);
     object_property_set_link(OBJECT(&s->armv7m), OBJECT(system_memory),
                                      "memory", &error_abort);
     object_property_set_bool(OBJECT(&s->armv7m), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
 
     /* System configuration controller */
     dev = DEVICE(&s->syscfg);
     object_property_set_bool(OBJECT(&s->syscfg), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
     busdev = SYS_BUS_DEVICE(dev);
     sysbus_mmio_map(busdev, 0, SYSCFG_ADD);
     sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, SYSCFG_IRQ));
 
     /* Attach UART (uses USART registers) and USART controllers */
     for (i = 0; i < STM_NUM_USARTS; i++) {
         dev = DEVICE(&(s->usart[i]));
         qdev_prop_set_chr(dev, "chardev", serial_hd(i));
         object_property_set_bool(OBJECT(&s->usart[i]), true, "realized", &err);
         if (err != NULL) {
             error_propagate(errp, err);
             return;
         }
         busdev = SYS_BUS_DEVICE(dev);
         sysbus_mmio_map(busdev, 0, usart_addr[i]);
         sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, usart_irq[i]));
     }
 
     /* Timer 2 to 5 */
     for (i = 0; i < STM_NUM_TIMERS; i++) {
         dev = DEVICE(&(s->timer[i]));
         qdev_prop_set_uint64(dev, "clock-frequency", 1000000000);
         object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err);
         if (err != NULL) {
             error_propagate(errp, err);
             return;
         }
         busdev = SYS_BUS_DEVICE(dev);
         sysbus_mmio_map(busdev, 0, timer_addr[i]);
         sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, timer_irq[i]));
     }
 
     /* ADC device, the IRQs are ORed together */
     object_initialize_child(OBJECT(s), "adc-orirq", &s->adc_irqs,
                             sizeof(s->adc_irqs), TYPE_OR_IRQ,
                             &err, NULL);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
     object_property_set_int(OBJECT(&s->adc_irqs), STM_NUM_ADCS,
                             "num-lines", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_bool(OBJECT(&s->adc_irqs), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
     qdev_connect_gpio_out(DEVICE(&s->adc_irqs), 0,
                           qdev_get_gpio_in(armv7m, ADC_IRQ));
 
     dev = DEVICE(&(s->adc[i]));
     object_property_set_bool(OBJECT(&s->adc[i]), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
     busdev = SYS_BUS_DEVICE(dev);
     sysbus_mmio_map(busdev, 0, ADC_ADDR);
     sysbus_connect_irq(busdev, 0,
                        qdev_get_gpio_in(DEVICE(&s->adc_irqs), i));
 
     /* SPI devices */
     for (i = 0; i < STM_NUM_SPIS; i++) {
         dev = DEVICE(&(s->spi[i]));
         object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err);
         if (err != NULL) {
             error_propagate(errp, err);
             return;
         }
         busdev = SYS_BUS_DEVICE(dev);
         sysbus_mmio_map(busdev, 0, spi_addr[i]);
         sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, spi_irq[i]));
     }
 
     /* EXTI device */
     dev = DEVICE(&s->exti);
     object_property_set_bool(OBJECT(&s->exti), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
     busdev = SYS_BUS_DEVICE(dev);
     sysbus_mmio_map(busdev, 0, EXTI_ADDR);
     for (i = 0; i < 16; i++) {
         sysbus_connect_irq(busdev, i, qdev_get_gpio_in(armv7m, exti_irq[i]));
     }
     for (i = 0; i < 16; i++) {
         qdev_connect_gpio_out(DEVICE(&s->syscfg), i, qdev_get_gpio_in(dev, i));
     }
 
     create_unimplemented_device("timer[7]",    0x40001400, 0x400);
     create_unimplemented_device("timer[12]",   0x40001800, 0x400);
     create_unimplemented_device("timer[6]",    0x40001000, 0x400);
     create_unimplemented_device("timer[13]",   0x40001C00, 0x400);
     create_unimplemented_device("timer[14]",   0x40002000, 0x400);
     create_unimplemented_device("RTC and BKP", 0x40002800, 0x400);
     create_unimplemented_device("WWDG",        0x40002C00, 0x400);
     create_unimplemented_device("IWDG",        0x40003000, 0x400);
     create_unimplemented_device("I2S2ext",     0x40003000, 0x400);
     create_unimplemented_device("I2S3ext",     0x40004000, 0x400);
     create_unimplemented_device("I2C1",        0x40005400, 0x400);
     create_unimplemented_device("I2C2",        0x40005800, 0x400);
     create_unimplemented_device("I2C3",        0x40005C00, 0x400);
     create_unimplemented_device("CAN1",        0x40006400, 0x400);
     create_unimplemented_device("CAN2",        0x40006800, 0x400);
     create_unimplemented_device("PWR",         0x40007000, 0x400);
     create_unimplemented_device("DAC",         0x40007400, 0x400);
     create_unimplemented_device("timer[1]",    0x40010000, 0x400);
     create_unimplemented_device("timer[8]",    0x40010400, 0x400);
     create_unimplemented_device("SDIO",        0x40012C00, 0x400);
     create_unimplemented_device("timer[9]",    0x40014000, 0x400);
     create_unimplemented_device("timer[10]",   0x40014400, 0x400);
     create_unimplemented_device("timer[11]",   0x40014800, 0x400);
     create_unimplemented_device("GPIOA",       0x40020000, 0x400);
     create_unimplemented_device("GPIOB",       0x40020400, 0x400);
     create_unimplemented_device("GPIOC",       0x40020800, 0x400);
     create_unimplemented_device("GPIOD",       0x40020C00, 0x400);
     create_unimplemented_device("GPIOE",       0x40021000, 0x400);
     create_unimplemented_device("GPIOF",       0x40021400, 0x400);
     create_unimplemented_device("GPIOG",       0x40021800, 0x400);
     create_unimplemented_device("GPIOH",       0x40021C00, 0x400);
     create_unimplemented_device("GPIOI",       0x40022000, 0x400);
     create_unimplemented_device("CRC",         0x40023000, 0x400);
     create_unimplemented_device("RCC",         0x40023800, 0x400);
     create_unimplemented_device("Flash Int",   0x40023C00, 0x400);
     create_unimplemented_device("BKPSRAM",     0x40024000, 0x400);
     create_unimplemented_device("DMA1",        0x40026000, 0x400);
     create_unimplemented_device("DMA2",        0x40026400, 0x400);
     create_unimplemented_device("Ethernet",    0x40028000, 0x1400);
     create_unimplemented_device("USB OTG HS",  0x40040000, 0x30000);
     create_unimplemented_device("USB OTG FS",  0x50000000, 0x31000);
     create_unimplemented_device("DCMI",        0x50050000, 0x400);
     create_unimplemented_device("RNG",         0x50060800, 0x400);
 }
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 05/12] hw/i386/x86: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 04/12] hw/arm/stm32fx05_soc: " Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-26 21:38   ` Peter Maydell
  2020-03-25 19:18 ` [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: " Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Patch created mechanically by running:

  $ spatch \
    --macro-file scripts/cocci-macro-file.h --include-headers \
    --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
    --keep-comments --smpl-spacing --in-place --dir hw

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/i386/x86.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 87b73fe33c..0a4865d4a9 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -103,13 +103,17 @@ uint32_t x86_cpu_apic_id_from_index(X86MachineState *x86ms,
 void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
 {
     Object *cpu = NULL;
     Error *local_err = NULL;
 
     cpu = object_new(MACHINE(x86ms)->cpu_type);
 
     object_property_set_uint(cpu, apic_id, "apic-id", &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
+        return;
+    }
     object_property_set_bool(cpu, true, "realized", &local_err);
 
     object_unref(cpu);
     error_propagate(errp, local_err);
 }
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 05/12] hw/i386/x86: " Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-25 20:52   ` Alistair Francis
  2020-03-26 21:46   ` Peter Maydell
  2020-03-25 19:18 ` [PATCH-for-5.0 07/12] hw/mips/cps: " Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  13 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Running the coccinelle script produced:

  $ 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

  [[manual check required: error_propagate() might be missing in object_property_set_link() hw//dma/xilinx_axidma.c:542:4]]

Add the missing error_propagate() after manual review.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/dma/xilinx_axidma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
index 018f36991b..6e3406321c 100644
--- a/hw/dma/xilinx_axidma.c
+++ b/hw/dma/xilinx_axidma.c
@@ -521,39 +521,42 @@ static const MemoryRegionOps axidma_ops = {
 static void xilinx_axidma_realize(DeviceState *dev, Error **errp)
 {
     XilinxAXIDMA *s = XILINX_AXI_DMA(dev);
     XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(&s->rx_data_dev);
     XilinxAXIDMAStreamSlave *cs = XILINX_AXI_DMA_CONTROL_STREAM(
                                                             &s->rx_control_dev);
     Error *local_err = NULL;
 
     object_property_add_link(OBJECT(ds), "dma", TYPE_XILINX_AXI_DMA,
                              (Object **)&ds->dma,
                              object_property_allow_set_link,
                              OBJ_PROP_LINK_STRONG,
                              &local_err);
     object_property_add_link(OBJECT(cs), "dma", TYPE_XILINX_AXI_DMA,
                              (Object **)&cs->dma,
                              object_property_allow_set_link,
                              OBJ_PROP_LINK_STRONG,
                              &local_err);
     if (local_err) {
         goto xilinx_axidma_realize_fail;
     }
     object_property_set_link(OBJECT(ds), OBJECT(s), "dma", &local_err);
+    if (local_err) {
+        goto xilinx_axidma_realize_fail;
+    }
     object_property_set_link(OBJECT(cs), OBJECT(s), "dma", &local_err);
     if (local_err) {
         goto xilinx_axidma_realize_fail;
     }
 
     int i;
 
     for (i = 0; i < 2; i++) {
         struct Stream *st = &s->streams[i];
 
         st->nr = i;
         st->ptimer = ptimer_init(timer_hit, st, PTIMER_POLICY_DEFAULT);
         ptimer_transaction_begin(st->ptimer);
         ptimer_set_freq(st->ptimer, s->freqhz);
         ptimer_transaction_commit(st->ptimer);
     }
     return;
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 07/12] hw/mips/cps: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: " Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-26 21:43   ` Peter Maydell
  2020-03-26 22:48   ` Aleksandar Markovic
  2020-03-25 19:18 ` [PATCH-for-5.0 08/12] hw/mips/boston: " Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  13 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Patch created mechanically by running:

  $ spatch \
    --macro-file scripts/cocci-macro-file.h --include-headers \
    --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
    --keep-comments --smpl-spacing --in-place --dir hw

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/mips/cps.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/hw/mips/cps.c b/hw/mips/cps.c
index 92b9b1a5f6..d682633401 100644
--- a/hw/mips/cps.c
+++ b/hw/mips/cps.c
@@ -68,100 +68,152 @@ static bool cpu_mips_itu_supported(CPUMIPSState *env)
 static void mips_cps_realize(DeviceState *dev, Error **errp)
 {
     MIPSCPSState *s = MIPS_CPS(dev);
     CPUMIPSState *env;
     MIPSCPU *cpu;
     int i;
     Error *err = NULL;
     target_ulong gcr_base;
     bool itu_present = false;
     bool saar_present = false;
 
     for (i = 0; i < s->num_vp; i++) {
         cpu = MIPS_CPU(cpu_create(s->cpu_type));
 
         /* Init internal devices */
         cpu_mips_irq_init_cpu(cpu);
         cpu_mips_clock_init(cpu);
 
         env = &cpu->env;
         if (cpu_mips_itu_supported(env)) {
             itu_present = true;
             /* Attach ITC Tag to the VP */
             env->itc_tag = mips_itu_get_tag_region(&s->itu);
             env->itu = &s->itu;
         }
         qemu_register_reset(main_cpu_reset, cpu);
     }
 
     cpu = MIPS_CPU(first_cpu);
     env = &cpu->env;
     saar_present = (bool)env->saarp;
 
     /* Inter-Thread Communication Unit */
     if (itu_present) {
         sysbus_init_child_obj(OBJECT(dev), "itu", &s->itu, sizeof(s->itu),
                               TYPE_MIPS_ITU);
         object_property_set_int(OBJECT(&s->itu), 16, "num-fifo", &err);
+        if (err) {
+            error_propagate(errp, err);
+            return;
+        }
         object_property_set_int(OBJECT(&s->itu), 16, "num-semaphores", &err);
+        if (err) {
+            error_propagate(errp, err);
+            return;
+        }
         object_property_set_bool(OBJECT(&s->itu), saar_present, "saar-present",
                                  &err);
+        if (err) {
+            error_propagate(errp, err);
+            return;
+        }
         if (saar_present) {
             s->itu.saar = &env->CP0_SAAR;
         }
         object_property_set_bool(OBJECT(&s->itu), true, "realized", &err);
+        if (err) {
+            error_propagate(errp, err);
+            return;
+        }
         if (err != NULL) {
             error_propagate(errp, err);
             return;
         }
 
         memory_region_add_subregion(&s->container, 0,
                            sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->itu), 0));
     }
 
     /* Cluster Power Controller */
     sysbus_init_child_obj(OBJECT(dev), "cpc", &s->cpc, sizeof(s->cpc),
                           TYPE_MIPS_CPC);
     object_property_set_int(OBJECT(&s->cpc), s->num_vp, "num-vp", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_int(OBJECT(&s->cpc), 1, "vp-start-running", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_bool(OBJECT(&s->cpc), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->container, 0,
                             sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->cpc), 0));
 
     /* Global Interrupt Controller */
     sysbus_init_child_obj(OBJECT(dev), "gic", &s->gic, sizeof(s->gic),
                           TYPE_MIPS_GIC);
     object_property_set_int(OBJECT(&s->gic), s->num_vp, "num-vp", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_int(OBJECT(&s->gic), 128, "num-irq", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_bool(OBJECT(&s->gic), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->container, 0,
                             sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gic), 0));
 
     /* Global Configuration Registers */
     gcr_base = env->CP0_CMGCRBase << 4;
 
     sysbus_init_child_obj(OBJECT(dev), "gcr", &s->gcr, sizeof(s->gcr),
                           TYPE_MIPS_GCR);
     object_property_set_int(OBJECT(&s->gcr), s->num_vp, "num-vp", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_int(OBJECT(&s->gcr), 0x800, "gcr-rev", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_int(OBJECT(&s->gcr), gcr_base, "gcr-base", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_link(OBJECT(&s->gcr), OBJECT(&s->gic.mr), "gic", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_link(OBJECT(&s->gcr), OBJECT(&s->cpc.mr), "cpc", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_bool(OBJECT(&s->gcr), true, "realized", &err);
     if (err != NULL) {
         error_propagate(errp, err);
         return;
     }
 
     memory_region_add_subregion(&s->container, gcr_base,
                             sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gcr), 0));
 }
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 08/12] hw/mips/boston: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 07/12] hw/mips/cps: " Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-26 21:47   ` Peter Maydell
  2020-03-26 22:50   ` Aleksandar Markovic
  2020-03-25 19:18 ` [PATCH-for-5.0 09/12] hw/mips/mips_malta: " Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  13 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Running the coccinelle script produced:

  $ 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

  [[manual check required: error_propagate() might be missing in object_property_set_int() hw/mips/boston.c:462:4]]
  [[manual check required: error_propagate() might be missing in object_property_set_str() hw/mips/boston.c:460:4]]

Since the uses are inside a MachineClass::init() function,
directly use &error_fatal instead of error_propagate().

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/mips/boston.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index 98ecd25e8e..2e821ca7d6 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -425,121 +425,116 @@ xilinx_pcie_init(MemoryRegion *sys_mem, uint32_t bus_nr,
 static void boston_mach_init(MachineState *machine)
 {
     DeviceState *dev;
     BostonState *s;
-    Error *err = NULL;
     MemoryRegion *flash, *ddr_low_alias, *lcd, *platreg;
     MemoryRegion *sys_mem = get_system_memory();
     XilinxPCIEHost *pcie2;
     PCIDevice *ahci;
     DriveInfo *hd[6];
     Chardev *chr;
     int fw_size, fit_err;
     bool is_64b;
 
     if ((machine->ram_size % GiB) ||
         (machine->ram_size > (2 * GiB))) {
         error_report("Memory size must be 1GB or 2GB");
         exit(1);
     }
 
     dev = qdev_create(NULL, TYPE_MIPS_BOSTON);
     qdev_init_nofail(dev);
 
     s = BOSTON(dev);
     s->mach = machine;
 
     if (!cpu_supports_cps_smp(machine->cpu_type)) {
         error_report("Boston requires CPUs which support CPS");
         exit(1);
     }
 
     is_64b = cpu_supports_isa(machine->cpu_type, ISA_MIPS64);
 
     sysbus_init_child_obj(OBJECT(machine), "cps", OBJECT(&s->cps),
                           sizeof(s->cps), TYPE_MIPS_CPS);
     object_property_set_str(OBJECT(&s->cps), machine->cpu_type, "cpu-type",
-                            &err);
-    object_property_set_int(OBJECT(&s->cps), machine->smp.cpus, "num-vp", &err);
-    object_property_set_bool(OBJECT(&s->cps), true, "realized", &err);
-
-    if (err != NULL) {
-        error_report("%s", error_get_pretty(err));
-        exit(1);
-    }
-
+                            &error_fatal);
+    object_property_set_int(OBJECT(&s->cps), machine->smp.cpus, "num-vp",
+                            &error_fatal);
+    object_property_set_bool(OBJECT(&s->cps), true, "realized", &error_fatal);
     sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
 
     flash =  g_new(MemoryRegion, 1);
-    memory_region_init_rom(flash, NULL, "boston.flash", 128 * MiB, &err);
+    memory_region_init_rom(flash, NULL, "boston.flash", 128 * MiB,
+                           &error_fatal);
     memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0);
 
     memory_region_add_subregion_overlap(sys_mem, 0x80000000, machine->ram, 0);
 
     ddr_low_alias = g_new(MemoryRegion, 1);
     memory_region_init_alias(ddr_low_alias, NULL, "boston_low.ddr",
                              machine->ram, 0,
                              MIN(machine->ram_size, (256 * MiB)));
     memory_region_add_subregion_overlap(sys_mem, 0, ddr_low_alias, 0);
 
     xilinx_pcie_init(sys_mem, 0,
                      0x10000000, 32 * MiB,
                      0x40000000, 1 * GiB,
                      get_cps_irq(&s->cps, 2), false);
 
     xilinx_pcie_init(sys_mem, 1,
                      0x12000000, 32 * MiB,
                      0x20000000, 512 * MiB,
                      get_cps_irq(&s->cps, 1), false);
 
     pcie2 = xilinx_pcie_init(sys_mem, 2,
                              0x14000000, 32 * MiB,
                              0x16000000, 1 * MiB,
                              get_cps_irq(&s->cps, 0), true);
 
     platreg = g_new(MemoryRegion, 1);
     memory_region_init_io(platreg, NULL, &boston_platreg_ops, s,
                           "boston-platregs", 0x1000);
     memory_region_add_subregion_overlap(sys_mem, 0x17ffd000, platreg, 0);
 
     s->uart = serial_mm_init(sys_mem, 0x17ffe000, 2,
                              get_cps_irq(&s->cps, 3), 10000000,
                              serial_hd(0), DEVICE_NATIVE_ENDIAN);
 
     lcd = g_new(MemoryRegion, 1);
     memory_region_init_io(lcd, NULL, &boston_lcd_ops, s, "boston-lcd", 0x8);
     memory_region_add_subregion_overlap(sys_mem, 0x17fff000, lcd, 0);
 
     chr = qemu_chr_new("lcd", "vc:320x240", NULL);
     qemu_chr_fe_init(&s->lcd_display, chr, NULL);
     qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,
                              boston_lcd_event, NULL, s, NULL, true);
 
     ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
                                            PCI_DEVFN(0, 0),
                                            true, TYPE_ICH9_AHCI);
     g_assert(ARRAY_SIZE(hd) == ahci_get_num_ports(ahci));
     ide_drive_get(hd, ahci_get_num_ports(ahci));
     ahci_ide_create_devs(ahci, hd);
 
     if (machine->firmware) {
         fw_size = load_image_targphys(machine->firmware,
                                       0x1fc00000, 4 * MiB);
         if (fw_size == -1) {
             error_report("unable to load firmware image '%s'",
                           machine->firmware);
             exit(1);
         }
     } else if (machine->kernel_filename) {
         fit_err = load_fit(&boston_fit_loader, machine->kernel_filename, s);
         if (fit_err) {
             error_report("unable to load FIT image");
             exit(1);
         }
 
         gen_firmware(memory_region_get_ram_ptr(flash) + 0x7c00000,
                      s->kernel_entry, s->fdt_base, is_64b);
     } else if (!qtest_enabled()) {
         error_report("Please provide either a -kernel or -bios argument");
         exit(1);
     }
 }
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 09/12] hw/mips/mips_malta: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 08/12] hw/mips/boston: " Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-26 21:49   ` Peter Maydell
  2020-03-26 22:49   ` Aleksandar Markovic
  2020-03-25 19:18 ` [PATCH-for-5.0 10/12] hw/misc/macio/macio: " Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  13 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Running the coccinelle script produced:

  $ 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

  [[manual check required: error_propagate() might be missing in object_property_set_int() hw/mips/mips_malta.c:1193:4]]
  [[manual check required: error_propagate() might be missing in object_property_set_str() hw/mips/mips_malta.c:1192:4]]

Add the missing error_propagate() after manual review by adding
a Error* parameter to create_cps().

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/mips/mips_malta.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index e4c4de1b4e..8d43cfd41b 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1183,22 +1183,31 @@ static void create_cpu_without_cps(MachineState *ms,
 }
 
 static void create_cps(MachineState *ms, MaltaState *s,
-                       qemu_irq *cbus_irq, qemu_irq *i8259_irq)
+                       qemu_irq *cbus_irq, qemu_irq *i8259_irq,
+                       Error **errp)
 {
     Error *err = NULL;
 
     sysbus_init_child_obj(OBJECT(s), "cps", OBJECT(&s->cps), sizeof(s->cps),
                           TYPE_MIPS_CPS);
     object_property_set_str(OBJECT(&s->cps), ms->cpu_type, "cpu-type", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_int(OBJECT(&s->cps), ms->smp.cpus, "num-vp", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     object_property_set_bool(OBJECT(&s->cps), true, "realized", &err);
-    if (err != NULL) {
-        error_report("%s", error_get_pretty(err));
-        exit(1);
+    if (err) {
+        error_propagate(errp, err);
+        return;
     }
 
     sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
 
     *i8259_irq = get_cps_irq(&s->cps, 3);
     *cbus_irq = NULL;
 }
@@ -1206,9 +1215,9 @@ static void create_cps(MachineState *ms, MaltaState *s,
 static void mips_create_cpu(MachineState *ms, MaltaState *s,
                             qemu_irq *cbus_irq, qemu_irq *i8259_irq)
 {
     if ((ms->smp.cpus > 1) && cpu_supports_cps_smp(ms->cpu_type)) {
-        create_cps(ms, s, cbus_irq, i8259_irq);
+        create_cps(ms, s, cbus_irq, i8259_irq, &error_fatal);
     } else {
         create_cpu_without_cps(ms, cbus_irq, i8259_irq);
     }
 }
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 10/12] hw/misc/macio/macio: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 09/12] hw/mips/mips_malta: " Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-25 23:55   ` David Gibson
  2020-03-26 21:50   ` Peter Maydell
  2020-03-25 19:18 ` [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: " Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  13 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Running the coccinelle script produced:

  $ 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

  [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/misc/macio/macio.c:350:8]]

Add the missing error_propagate() after manual review.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/misc/macio/macio.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 79222192e8..fffb64a7d5 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -292,98 +292,102 @@ static const MemoryRegionOps timer_ops = {
 static void macio_newworld_realize(PCIDevice *d, Error **errp)
 {
     MacIOState *s = MACIO(d);
     NewWorldMacIOState *ns = NEWWORLD_MACIO(d);
     DeviceState *pic_dev = DEVICE(ns->pic);
     Error *err = NULL;
     SysBusDevice *sysbus_dev;
     MemoryRegion *timer_memory = NULL;
 
     macio_common_realize(d, &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     sysbus_dev = SYS_BUS_DEVICE(&s->escc);
     sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
                                                        NEWWORLD_ESCCB_IRQ));
     sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev,
                                                        NEWWORLD_ESCCA_IRQ));
 
     /* OpenPIC */
     sysbus_dev = SYS_BUS_DEVICE(ns->pic);
     memory_region_add_subregion(&s->bar, 0x40000,
                                 sysbus_mmio_get_region(sysbus_dev, 0));
 
     /* IDE buses */
     macio_realize_ide(s, &ns->ide[0],
                       qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_IRQ),
                       qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_DMA_IRQ),
                       0x16, &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     macio_realize_ide(s, &ns->ide[1],
                       qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_IRQ),
                       qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_DMA_IRQ),
                       0x1a, &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
 
     /* Timer */
     timer_memory = g_new(MemoryRegion, 1);
     memory_region_init_io(timer_memory, OBJECT(s), &timer_ops, NULL, "timer",
                           0x1000);
     memory_region_add_subregion(&s->bar, 0x15000, timer_memory);
 
     if (ns->has_pmu) {
         /* GPIOs */
         sysbus_dev = SYS_BUS_DEVICE(&ns->gpio);
         object_property_set_link(OBJECT(&ns->gpio), OBJECT(pic_dev), "pic",
                                  &error_abort);
         memory_region_add_subregion(&s->bar, 0x50,
                                     sysbus_mmio_get_region(sysbus_dev, 0));
         object_property_set_bool(OBJECT(&ns->gpio), true, "realized", &err);
+        if (err) {
+            error_propagate(errp, err);
+            return;
+        }
 
         /* PMU */
         object_initialize_child(OBJECT(s), "pmu", &s->pmu, sizeof(s->pmu),
                                 TYPE_VIA_PMU, &error_abort, NULL);
         object_property_set_link(OBJECT(&s->pmu), OBJECT(sysbus_dev), "gpio",
                                  &error_abort);
         qdev_prop_set_bit(DEVICE(&s->pmu), "has-adb", ns->has_adb);
         qdev_set_parent_bus(DEVICE(&s->pmu), BUS(&s->macio_bus));
 
         object_property_set_bool(OBJECT(&s->pmu), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
         sysbus_dev = SYS_BUS_DEVICE(&s->pmu);
         sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
                                                            NEWWORLD_PMU_IRQ));
         memory_region_add_subregion(&s->bar, 0x16000,
                                     sysbus_mmio_get_region(sysbus_dev, 0));
     } else {
         /* CUDA */
         object_initialize_child(OBJECT(s), "cuda", &s->cuda, sizeof(s->cuda),
                                 TYPE_CUDA, &error_abort, NULL);
         qdev_set_parent_bus(DEVICE(&s->cuda), BUS(&s->macio_bus));
         qdev_prop_set_uint64(DEVICE(&s->cuda), "timebase-frequency",
                              s->frequency);
 
         object_property_set_bool(OBJECT(&s->cuda), true, "realized", &err);
         if (err) {
             error_propagate(errp, err);
             return;
         }
         sysbus_dev = SYS_BUS_DEVICE(&s->cuda);
         sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
                                                            NEWWORLD_CUDA_IRQ));
         memory_region_add_subregion(&s->bar, 0x16000,
                                     sysbus_mmio_get_region(sysbus_dev, 0));
     }
 }
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 10/12] hw/misc/macio/macio: " Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-25 20:52   ` Alistair Francis
  2020-03-26 21:51   ` Peter Maydell
  2020-03-25 19:18 ` [PATCH-for-5.0 12/12] hw/riscv/sifive_u: " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  13 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Running the coccinelle script produced:

  $ 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

  [[manual check required: error_propagate() might be missing in object_property_set_link() hw/net/xilinx_axienet.c:969:4]]

Add the missing error_propagate() after manual review.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/net/xilinx_axienet.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
index 704788811a..f11510a71e 100644
--- a/hw/net/xilinx_axienet.c
+++ b/hw/net/xilinx_axienet.c
@@ -948,39 +948,42 @@ static NetClientInfo net_xilinx_enet_info = {
 static void xilinx_enet_realize(DeviceState *dev, Error **errp)
 {
     XilinxAXIEnet *s = XILINX_AXI_ENET(dev);
     XilinxAXIEnetStreamSlave *ds = XILINX_AXI_ENET_DATA_STREAM(&s->rx_data_dev);
     XilinxAXIEnetStreamSlave *cs = XILINX_AXI_ENET_CONTROL_STREAM(
                                                             &s->rx_control_dev);
     Error *local_err = NULL;
 
     object_property_add_link(OBJECT(ds), "enet", "xlnx.axi-ethernet",
                              (Object **) &ds->enet,
                              object_property_allow_set_link,
                              OBJ_PROP_LINK_STRONG,
                              &local_err);
     object_property_add_link(OBJECT(cs), "enet", "xlnx.axi-ethernet",
                              (Object **) &cs->enet,
                              object_property_allow_set_link,
                              OBJ_PROP_LINK_STRONG,
                              &local_err);
     if (local_err) {
         goto xilinx_enet_realize_fail;
     }
     object_property_set_link(OBJECT(ds), OBJECT(s), "enet", &local_err);
+    if (local_err) {
+        goto xilinx_enet_realize_fail;
+    }
     object_property_set_link(OBJECT(cs), OBJECT(s), "enet", &local_err);
     if (local_err) {
         goto xilinx_enet_realize_fail;
     }
 
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     s->nic = qemu_new_nic(&net_xilinx_enet_info, &s->conf,
                           object_get_typename(OBJECT(dev)), dev->id, s);
     qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
 
     tdk_init(&s->TEMAC.phy);
     mdio_attach(&s->TEMAC.mdio_bus, &s->TEMAC.phy, s->c_phyaddr);
 
     s->TEMAC.parent = s;
 
     s->rxmem = g_malloc(s->c_rxmem);
     return;
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH-for-5.0 12/12] hw/riscv/sifive_u: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: " Philippe Mathieu-Daudé
@ 2020-03-25 19:18 ` Philippe Mathieu-Daudé
  2020-03-25 20:52   ` Alistair Francis
  2020-03-26 21:55   ` Peter Maydell
  2020-03-25 19:20 ` [PATCH-for-5.0 00/12] hw: " Philippe Mathieu-Daudé
  2020-03-31 13:23 ` Markus Armbruster
  13 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Running the coccinelle script produced:

  $ 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

  [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/riscv/sifive_u.c:558:4]]
  [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/riscv/sifive_u.c:561:4]]

Add the missing error_propagate() after manual review.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/riscv/sifive_u.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 56351c4faa..01e44018cd 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -473,113 +473,121 @@ static void riscv_sifive_u_machine_instance_init(Object *obj)
 static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
 {
     MachineState *ms = MACHINE(qdev_get_machine());
     SiFiveUSoCState *s = RISCV_U_SOC(dev);
     const struct MemmapEntry *memmap = sifive_u_memmap;
     MemoryRegion *system_memory = get_system_memory();
     MemoryRegion *mask_rom = g_new(MemoryRegion, 1);
     MemoryRegion *l2lim_mem = g_new(MemoryRegion, 1);
     qemu_irq plic_gpios[SIFIVE_U_PLIC_NUM_SOURCES];
     char *plic_hart_config;
     size_t plic_hart_config_len;
     int i;
     Error *err = NULL;
     NICInfo *nd = &nd_table[0];
 
     object_property_set_bool(OBJECT(&s->e_cpus), true, "realized",
                              &error_abort);
     object_property_set_bool(OBJECT(&s->u_cpus), true, "realized",
                              &error_abort);
     /*
      * The cluster must be realized after the RISC-V hart array container,
      * as the container's CPU object is only created on realize, and the
      * CPU must exist and have been parented into the cluster before the
      * cluster is realized.
      */
     object_property_set_bool(OBJECT(&s->e_cluster), true, "realized",
                              &error_abort);
     object_property_set_bool(OBJECT(&s->u_cluster), true, "realized",
                              &error_abort);
 
     /* boot rom */
     memory_region_init_rom(mask_rom, OBJECT(dev), "riscv.sifive.u.mrom",
                            memmap[SIFIVE_U_MROM].size, &error_fatal);
     memory_region_add_subregion(system_memory, memmap[SIFIVE_U_MROM].base,
                                 mask_rom);
 
     /*
      * Add L2-LIM at reset size.
      * This should be reduced in size as the L2 Cache Controller WayEnable
      * register is incremented. Unfortunately I don't see a nice (or any) way
      * to handle reducing or blocking out the L2 LIM while still allowing it
      * be re returned to all enabled after a reset. For the time being, just
      * leave it enabled all the time. This won't break anything, but will be
      * too generous to misbehaving guests.
      */
     memory_region_init_ram(l2lim_mem, NULL, "riscv.sifive.u.l2lim",
                            memmap[SIFIVE_U_L2LIM].size, &error_fatal);
     memory_region_add_subregion(system_memory, memmap[SIFIVE_U_L2LIM].base,
                                 l2lim_mem);
 
     /* create PLIC hart topology configuration string */
     plic_hart_config_len = (strlen(SIFIVE_U_PLIC_HART_CONFIG) + 1) *
                            ms->smp.cpus;
     plic_hart_config = g_malloc0(plic_hart_config_len);
     for (i = 0; i < ms->smp.cpus; i++) {
         if (i != 0) {
             strncat(plic_hart_config, "," SIFIVE_U_PLIC_HART_CONFIG,
                     plic_hart_config_len);
         } else {
             strncat(plic_hart_config, "M", plic_hart_config_len);
         }
         plic_hart_config_len -= (strlen(SIFIVE_U_PLIC_HART_CONFIG) + 1);
     }
 
     /* MMIO */
     s->plic = sifive_plic_create(memmap[SIFIVE_U_PLIC].base,
         plic_hart_config,
         SIFIVE_U_PLIC_NUM_SOURCES,
         SIFIVE_U_PLIC_NUM_PRIORITIES,
         SIFIVE_U_PLIC_PRIORITY_BASE,
         SIFIVE_U_PLIC_PENDING_BASE,
         SIFIVE_U_PLIC_ENABLE_BASE,
         SIFIVE_U_PLIC_ENABLE_STRIDE,
         SIFIVE_U_PLIC_CONTEXT_BASE,
         SIFIVE_U_PLIC_CONTEXT_STRIDE,
         memmap[SIFIVE_U_PLIC].size);
     g_free(plic_hart_config);
     sifive_uart_create(system_memory, memmap[SIFIVE_U_UART0].base,
         serial_hd(0), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_UART0_IRQ));
     sifive_uart_create(system_memory, memmap[SIFIVE_U_UART1].base,
         serial_hd(1), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_UART1_IRQ));
     sifive_clint_create(memmap[SIFIVE_U_CLINT].base,
         memmap[SIFIVE_U_CLINT].size, ms->smp.cpus,
         SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE, false);
 
     object_property_set_bool(OBJECT(&s->prci), true, "realized", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->prci), 0, memmap[SIFIVE_U_PRCI].base);
 
     object_property_set_bool(OBJECT(&s->otp), true, "realized", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->otp), 0, memmap[SIFIVE_U_OTP].base);
 
     for (i = 0; i < SIFIVE_U_PLIC_NUM_SOURCES; i++) {
         plic_gpios[i] = qdev_get_gpio_in(DEVICE(s->plic), i);
     }
 
     if (nd->used) {
         qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
         qdev_set_nic_properties(DEVICE(&s->gem), nd);
     }
     object_property_set_int(OBJECT(&s->gem), GEM_REVISION, "revision",
                             &error_abort);
     object_property_set_bool(OBJECT(&s->gem), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->gem), 0, memmap[SIFIVE_U_GEM].base);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->gem), 0,
                        plic_gpios[SIFIVE_U_GEM_IRQ]);
 
     create_unimplemented_device("riscv.sifive.u.gem-mgmt",
         memmap[SIFIVE_U_GEM_MGMT].base, memmap[SIFIVE_U_GEM_MGMT].size);
 }
-- 
2.21.1



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 00/12] hw: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2020-03-25 19:18 ` [PATCH-for-5.0 12/12] hw/riscv/sifive_u: " Philippe Mathieu-Daudé
@ 2020-03-25 19:20 ` Philippe Mathieu-Daudé
  2020-03-30  9:21   ` Stefan Hajnoczi
  2020-03-31 13:23 ` Markus Armbruster
  13 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-25 19:20 UTC (permalink / raw)
  To: qemu-devel@nongnu.org Developers, Stefan Hajnoczi
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc@nongnu.org list:PowerPC,
	Paolo Bonzini, Aurelien Jarno

On Wed, Mar 25, 2020 at 8:18 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> This series is inspired of Peter fix:
> "hw/arm/xlnx-zynqmp.c: fix some error-handling code"
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg691636.html
>
> Add a cocci script to fix the other places.
>
> Based-on: <20200324134947.15384-1-peter.maydell@linaro.org>
>
> Philippe Mathieu-Daud=C3=A9 (12):

Hmm is that a git-publish bug?

>   scripts/coccinelle: Add script to catch missing error_propagate()
>     calls
>   hw/arm/bcm2835_peripherals: Add missing error-propagation code
>   hw/arm/fsl-imx: Add missing error-propagation code
>   hw/arm/stm32fx05_soc: Add missing error-propagation code
>   hw/i386/x86: Add missing error-propagation code
>   hw/dma/xilinx_axidma: Add missing error-propagation code
>   hw/mips/cps: Add missing error-propagation code
>   hw/mips/boston: Add missing error-propagation code
>   hw/mips/mips_malta: Add missing error-propagation code
>   hw/misc/macio/macio: Add missing error-propagation code
>   hw/net/xilinx_axienet: Add missing error-propagation code
>   hw/riscv/sifive_u: Add missing error-propagation code
>
>  ...ect_property_missing_error_propagate.cocci | 58 +++++++++++++++++++
>  hw/arm/bcm2835_peripherals.c                  |  8 +++
>  hw/arm/fsl-imx25.c                            |  8 +++
>  hw/arm/fsl-imx6.c                             |  8 +++
>  hw/arm/stm32f205_soc.c                        |  4 ++
>  hw/arm/stm32f405_soc.c                        |  4 ++
>  hw/dma/xilinx_axidma.c                        |  3 +
>  hw/i386/x86.c                                 |  4 ++
>  hw/mips/boston.c                              | 17 ++----
>  hw/mips/cps.c                                 | 52 +++++++++++++++++
>  hw/mips/mips_malta.c                          | 19 ++++--
>  hw/misc/macio/macio.c                         |  4 ++
>  hw/net/xilinx_axienet.c                       |  3 +
>  hw/riscv/sifive_u.c                           |  8 +++
>  14 files changed, 184 insertions(+), 16 deletions(-)
>  create mode 100644 scripts/coccinelle/object_property_missing_error_propagat=
> e.cocci
>
> --=20
> 2.21.1
>


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 04/12] hw/arm/stm32fx05_soc: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 04/12] hw/arm/stm32fx05_soc: " Philippe Mathieu-Daudé
@ 2020-03-25 20:51   ` Alistair Francis
  2020-03-26 21:45   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: Alistair Francis @ 2020-03-25 20:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, qemu-devel@nongnu.org Developers,
	Alistair Francis, Edgar E. Iglesias, Peter Maydell,
	Markus Armbruster, Aleksandar Markovic, open list:New World,
	Aleksandar Rikalo, Richard Henderson, Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, Palmer Dabbelt, Paolo Bonzini,
	Aurelien Jarno

On Wed, Mar 25, 2020 at 12:22 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Patch created mechanically by running:
>
>   $ spatch \
>     --macro-file scripts/cocci-macro-file.h --include-headers \
>     --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
>     --keep-comments --smpl-spacing --in-place --dir hw
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/arm/stm32f205_soc.c | 4 ++++
>  hw/arm/stm32f405_soc.c | 4 ++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
> index 118c342559..1d80f91dd7 100644
> --- a/hw/arm/stm32f205_soc.c
> +++ b/hw/arm/stm32f205_soc.c
> @@ -83,113 +83,117 @@ static void stm32f205_soc_initfn(Object *obj)
>  static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
>  {
>      STM32F205State *s = STM32F205_SOC(dev_soc);
>      DeviceState *dev, *armv7m;
>      SysBusDevice *busdev;
>      Error *err = NULL;
>      int i;
>
>      MemoryRegion *system_memory = get_system_memory();
>      MemoryRegion *sram = g_new(MemoryRegion, 1);
>      MemoryRegion *flash = g_new(MemoryRegion, 1);
>      MemoryRegion *flash_alias = g_new(MemoryRegion, 1);
>
>      memory_region_init_rom(flash, OBJECT(dev_soc), "STM32F205.flash",
>                             FLASH_SIZE, &error_fatal);
>      memory_region_init_alias(flash_alias, OBJECT(dev_soc),
>                               "STM32F205.flash.alias", flash, 0, FLASH_SIZE);
>
>      memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash);
>      memory_region_add_subregion(system_memory, 0, flash_alias);
>
>      memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE,
>                             &error_fatal);
>      memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram);
>
>      armv7m = DEVICE(&s->armv7m);
>      qdev_prop_set_uint32(armv7m, "num-irq", 96);
>      qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type);
>      qdev_prop_set_bit(armv7m, "enable-bitband", true);
>      object_property_set_link(OBJECT(&s->armv7m), OBJECT(get_system_memory()),
>                                       "memory", &error_abort);
>      object_property_set_bool(OBJECT(&s->armv7m), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>
>      /* System configuration controller */
>      dev = DEVICE(&s->syscfg);
>      object_property_set_bool(OBJECT(&s->syscfg), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>      busdev = SYS_BUS_DEVICE(dev);
>      sysbus_mmio_map(busdev, 0, 0x40013800);
>      sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, 71));
>
>      /* Attach UART (uses USART registers) and USART controllers */
>      for (i = 0; i < STM_NUM_USARTS; i++) {
>          dev = DEVICE(&(s->usart[i]));
>          qdev_prop_set_chr(dev, "chardev", serial_hd(i));
>          object_property_set_bool(OBJECT(&s->usart[i]), true, "realized", &err);
>          if (err != NULL) {
>              error_propagate(errp, err);
>              return;
>          }
>          busdev = SYS_BUS_DEVICE(dev);
>          sysbus_mmio_map(busdev, 0, usart_addr[i]);
>          sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, usart_irq[i]));
>      }
>
>      /* Timer 2 to 5 */
>      for (i = 0; i < STM_NUM_TIMERS; i++) {
>          dev = DEVICE(&(s->timer[i]));
>          qdev_prop_set_uint64(dev, "clock-frequency", 1000000000);
>          object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err);
>          if (err != NULL) {
>              error_propagate(errp, err);
>              return;
>          }
>          busdev = SYS_BUS_DEVICE(dev);
>          sysbus_mmio_map(busdev, 0, timer_addr[i]);
>          sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, timer_irq[i]));
>      }
>
>      /* ADC 1 to 3 */
>      object_property_set_int(OBJECT(s->adc_irqs), STM_NUM_ADCS,
>                              "num-lines", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_bool(OBJECT(s->adc_irqs), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>      qdev_connect_gpio_out(DEVICE(s->adc_irqs), 0,
>                            qdev_get_gpio_in(armv7m, ADC_IRQ));
>
>      for (i = 0; i < STM_NUM_ADCS; i++) {
>          dev = DEVICE(&(s->adc[i]));
>          object_property_set_bool(OBJECT(&s->adc[i]), true, "realized", &err);
>          if (err != NULL) {
>              error_propagate(errp, err);
>              return;
>          }
>          busdev = SYS_BUS_DEVICE(dev);
>          sysbus_mmio_map(busdev, 0, adc_addr[i]);
>          sysbus_connect_irq(busdev, 0,
>                             qdev_get_gpio_in(DEVICE(s->adc_irqs), i));
>      }
>
>      /* SPI 1 and 2 */
>      for (i = 0; i < STM_NUM_SPIS; i++) {
>          dev = DEVICE(&(s->spi[i]));
>          object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err);
>          if (err != NULL) {
>              error_propagate(errp, err);
>              return;
>          }
>          busdev = SYS_BUS_DEVICE(dev);
>          sysbus_mmio_map(busdev, 0, spi_addr[i]);
>          sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, spi_irq[i]));
>      }
>  }
> diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c
> index 4f10ce6176..398a3b5b4f 100644
> --- a/hw/arm/stm32f405_soc.c
> +++ b/hw/arm/stm32f405_soc.c
> @@ -89,183 +89,187 @@ static void stm32f405_soc_initfn(Object *obj)
>  static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp)
>  {
>      STM32F405State *s = STM32F405_SOC(dev_soc);
>      MemoryRegion *system_memory = get_system_memory();
>      DeviceState *dev, *armv7m;
>      SysBusDevice *busdev;
>      Error *err = NULL;
>      int i;
>
>      memory_region_init_rom(&s->flash, OBJECT(dev_soc), "STM32F405.flash",
>                             FLASH_SIZE, &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>      memory_region_init_alias(&s->flash_alias, OBJECT(dev_soc),
>                               "STM32F405.flash.alias", &s->flash, 0,
>                               FLASH_SIZE);
>
>      memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->flash);
>      memory_region_add_subregion(system_memory, 0, &s->flash_alias);
>
>      memory_region_init_ram(&s->sram, NULL, "STM32F405.sram", SRAM_SIZE,
>                             &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>      memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, &s->sram);
>
>      armv7m = DEVICE(&s->armv7m);
>      qdev_prop_set_uint32(armv7m, "num-irq", 96);
>      qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type);
>      qdev_prop_set_bit(armv7m, "enable-bitband", true);
>      object_property_set_link(OBJECT(&s->armv7m), OBJECT(system_memory),
>                                       "memory", &error_abort);
>      object_property_set_bool(OBJECT(&s->armv7m), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>
>      /* System configuration controller */
>      dev = DEVICE(&s->syscfg);
>      object_property_set_bool(OBJECT(&s->syscfg), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>      busdev = SYS_BUS_DEVICE(dev);
>      sysbus_mmio_map(busdev, 0, SYSCFG_ADD);
>      sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, SYSCFG_IRQ));
>
>      /* Attach UART (uses USART registers) and USART controllers */
>      for (i = 0; i < STM_NUM_USARTS; i++) {
>          dev = DEVICE(&(s->usart[i]));
>          qdev_prop_set_chr(dev, "chardev", serial_hd(i));
>          object_property_set_bool(OBJECT(&s->usart[i]), true, "realized", &err);
>          if (err != NULL) {
>              error_propagate(errp, err);
>              return;
>          }
>          busdev = SYS_BUS_DEVICE(dev);
>          sysbus_mmio_map(busdev, 0, usart_addr[i]);
>          sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, usart_irq[i]));
>      }
>
>      /* Timer 2 to 5 */
>      for (i = 0; i < STM_NUM_TIMERS; i++) {
>          dev = DEVICE(&(s->timer[i]));
>          qdev_prop_set_uint64(dev, "clock-frequency", 1000000000);
>          object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err);
>          if (err != NULL) {
>              error_propagate(errp, err);
>              return;
>          }
>          busdev = SYS_BUS_DEVICE(dev);
>          sysbus_mmio_map(busdev, 0, timer_addr[i]);
>          sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, timer_irq[i]));
>      }
>
>      /* ADC device, the IRQs are ORed together */
>      object_initialize_child(OBJECT(s), "adc-orirq", &s->adc_irqs,
>                              sizeof(s->adc_irqs), TYPE_OR_IRQ,
>                              &err, NULL);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>      object_property_set_int(OBJECT(&s->adc_irqs), STM_NUM_ADCS,
>                              "num-lines", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_bool(OBJECT(&s->adc_irqs), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>      qdev_connect_gpio_out(DEVICE(&s->adc_irqs), 0,
>                            qdev_get_gpio_in(armv7m, ADC_IRQ));
>
>      dev = DEVICE(&(s->adc[i]));
>      object_property_set_bool(OBJECT(&s->adc[i]), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>      busdev = SYS_BUS_DEVICE(dev);
>      sysbus_mmio_map(busdev, 0, ADC_ADDR);
>      sysbus_connect_irq(busdev, 0,
>                         qdev_get_gpio_in(DEVICE(&s->adc_irqs), i));
>
>      /* SPI devices */
>      for (i = 0; i < STM_NUM_SPIS; i++) {
>          dev = DEVICE(&(s->spi[i]));
>          object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err);
>          if (err != NULL) {
>              error_propagate(errp, err);
>              return;
>          }
>          busdev = SYS_BUS_DEVICE(dev);
>          sysbus_mmio_map(busdev, 0, spi_addr[i]);
>          sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, spi_irq[i]));
>      }
>
>      /* EXTI device */
>      dev = DEVICE(&s->exti);
>      object_property_set_bool(OBJECT(&s->exti), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>      busdev = SYS_BUS_DEVICE(dev);
>      sysbus_mmio_map(busdev, 0, EXTI_ADDR);
>      for (i = 0; i < 16; i++) {
>          sysbus_connect_irq(busdev, i, qdev_get_gpio_in(armv7m, exti_irq[i]));
>      }
>      for (i = 0; i < 16; i++) {
>          qdev_connect_gpio_out(DEVICE(&s->syscfg), i, qdev_get_gpio_in(dev, i));
>      }
>
>      create_unimplemented_device("timer[7]",    0x40001400, 0x400);
>      create_unimplemented_device("timer[12]",   0x40001800, 0x400);
>      create_unimplemented_device("timer[6]",    0x40001000, 0x400);
>      create_unimplemented_device("timer[13]",   0x40001C00, 0x400);
>      create_unimplemented_device("timer[14]",   0x40002000, 0x400);
>      create_unimplemented_device("RTC and BKP", 0x40002800, 0x400);
>      create_unimplemented_device("WWDG",        0x40002C00, 0x400);
>      create_unimplemented_device("IWDG",        0x40003000, 0x400);
>      create_unimplemented_device("I2S2ext",     0x40003000, 0x400);
>      create_unimplemented_device("I2S3ext",     0x40004000, 0x400);
>      create_unimplemented_device("I2C1",        0x40005400, 0x400);
>      create_unimplemented_device("I2C2",        0x40005800, 0x400);
>      create_unimplemented_device("I2C3",        0x40005C00, 0x400);
>      create_unimplemented_device("CAN1",        0x40006400, 0x400);
>      create_unimplemented_device("CAN2",        0x40006800, 0x400);
>      create_unimplemented_device("PWR",         0x40007000, 0x400);
>      create_unimplemented_device("DAC",         0x40007400, 0x400);
>      create_unimplemented_device("timer[1]",    0x40010000, 0x400);
>      create_unimplemented_device("timer[8]",    0x40010400, 0x400);
>      create_unimplemented_device("SDIO",        0x40012C00, 0x400);
>      create_unimplemented_device("timer[9]",    0x40014000, 0x400);
>      create_unimplemented_device("timer[10]",   0x40014400, 0x400);
>      create_unimplemented_device("timer[11]",   0x40014800, 0x400);
>      create_unimplemented_device("GPIOA",       0x40020000, 0x400);
>      create_unimplemented_device("GPIOB",       0x40020400, 0x400);
>      create_unimplemented_device("GPIOC",       0x40020800, 0x400);
>      create_unimplemented_device("GPIOD",       0x40020C00, 0x400);
>      create_unimplemented_device("GPIOE",       0x40021000, 0x400);
>      create_unimplemented_device("GPIOF",       0x40021400, 0x400);
>      create_unimplemented_device("GPIOG",       0x40021800, 0x400);
>      create_unimplemented_device("GPIOH",       0x40021C00, 0x400);
>      create_unimplemented_device("GPIOI",       0x40022000, 0x400);
>      create_unimplemented_device("CRC",         0x40023000, 0x400);
>      create_unimplemented_device("RCC",         0x40023800, 0x400);
>      create_unimplemented_device("Flash Int",   0x40023C00, 0x400);
>      create_unimplemented_device("BKPSRAM",     0x40024000, 0x400);
>      create_unimplemented_device("DMA1",        0x40026000, 0x400);
>      create_unimplemented_device("DMA2",        0x40026400, 0x400);
>      create_unimplemented_device("Ethernet",    0x40028000, 0x1400);
>      create_unimplemented_device("USB OTG HS",  0x40040000, 0x30000);
>      create_unimplemented_device("USB OTG FS",  0x50000000, 0x31000);
>      create_unimplemented_device("DCMI",        0x50050000, 0x400);
>      create_unimplemented_device("RNG",         0x50060800, 0x400);
>  }
> --
> 2.21.1
>
>


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: " Philippe Mathieu-Daudé
@ 2020-03-25 20:52   ` Alistair Francis
  2020-03-26 21:46   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: Alistair Francis @ 2020-03-25 20:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, qemu-devel@nongnu.org Developers,
	Alistair Francis, Edgar E. Iglesias, Peter Maydell,
	Markus Armbruster, Aleksandar Markovic, open list:New World,
	Aleksandar Rikalo, Richard Henderson, Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, Palmer Dabbelt, Paolo Bonzini,
	Aurelien Jarno

On Wed, Mar 25, 2020 at 12:24 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in object_property_set_link() hw//dma/xilinx_axidma.c:542:4]]
>
> Add the missing error_propagate() after manual review.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/dma/xilinx_axidma.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
> index 018f36991b..6e3406321c 100644
> --- a/hw/dma/xilinx_axidma.c
> +++ b/hw/dma/xilinx_axidma.c
> @@ -521,39 +521,42 @@ static const MemoryRegionOps axidma_ops = {
>  static void xilinx_axidma_realize(DeviceState *dev, Error **errp)
>  {
>      XilinxAXIDMA *s = XILINX_AXI_DMA(dev);
>      XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(&s->rx_data_dev);
>      XilinxAXIDMAStreamSlave *cs = XILINX_AXI_DMA_CONTROL_STREAM(
>                                                              &s->rx_control_dev);
>      Error *local_err = NULL;
>
>      object_property_add_link(OBJECT(ds), "dma", TYPE_XILINX_AXI_DMA,
>                               (Object **)&ds->dma,
>                               object_property_allow_set_link,
>                               OBJ_PROP_LINK_STRONG,
>                               &local_err);
>      object_property_add_link(OBJECT(cs), "dma", TYPE_XILINX_AXI_DMA,
>                               (Object **)&cs->dma,
>                               object_property_allow_set_link,
>                               OBJ_PROP_LINK_STRONG,
>                               &local_err);
>      if (local_err) {
>          goto xilinx_axidma_realize_fail;
>      }
>      object_property_set_link(OBJECT(ds), OBJECT(s), "dma", &local_err);
> +    if (local_err) {
> +        goto xilinx_axidma_realize_fail;
> +    }
>      object_property_set_link(OBJECT(cs), OBJECT(s), "dma", &local_err);
>      if (local_err) {
>          goto xilinx_axidma_realize_fail;
>      }
>
>      int i;
>
>      for (i = 0; i < 2; i++) {
>          struct Stream *st = &s->streams[i];
>
>          st->nr = i;
>          st->ptimer = ptimer_init(timer_hit, st, PTIMER_POLICY_DEFAULT);
>          ptimer_transaction_begin(st->ptimer);
>          ptimer_set_freq(st->ptimer, s->freqhz);
>          ptimer_transaction_commit(st->ptimer);
>      }
>      return;
> --
> 2.21.1
>
>


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: " Philippe Mathieu-Daudé
@ 2020-03-25 20:52   ` Alistair Francis
  2020-03-26 21:51   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: Alistair Francis @ 2020-03-25 20:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, qemu-devel@nongnu.org Developers,
	Alistair Francis, Edgar E. Iglesias, Peter Maydell,
	Markus Armbruster, Aleksandar Markovic, open list:New World,
	Aleksandar Rikalo, Richard Henderson, Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, Palmer Dabbelt, Paolo Bonzini,
	Aurelien Jarno

On Wed, Mar 25, 2020 at 12:26 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in object_property_set_link() hw/net/xilinx_axienet.c:969:4]]
>
> Add the missing error_propagate() after manual review.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/net/xilinx_axienet.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
> index 704788811a..f11510a71e 100644
> --- a/hw/net/xilinx_axienet.c
> +++ b/hw/net/xilinx_axienet.c
> @@ -948,39 +948,42 @@ static NetClientInfo net_xilinx_enet_info = {
>  static void xilinx_enet_realize(DeviceState *dev, Error **errp)
>  {
>      XilinxAXIEnet *s = XILINX_AXI_ENET(dev);
>      XilinxAXIEnetStreamSlave *ds = XILINX_AXI_ENET_DATA_STREAM(&s->rx_data_dev);
>      XilinxAXIEnetStreamSlave *cs = XILINX_AXI_ENET_CONTROL_STREAM(
>                                                              &s->rx_control_dev);
>      Error *local_err = NULL;
>
>      object_property_add_link(OBJECT(ds), "enet", "xlnx.axi-ethernet",
>                               (Object **) &ds->enet,
>                               object_property_allow_set_link,
>                               OBJ_PROP_LINK_STRONG,
>                               &local_err);
>      object_property_add_link(OBJECT(cs), "enet", "xlnx.axi-ethernet",
>                               (Object **) &cs->enet,
>                               object_property_allow_set_link,
>                               OBJ_PROP_LINK_STRONG,
>                               &local_err);
>      if (local_err) {
>          goto xilinx_enet_realize_fail;
>      }
>      object_property_set_link(OBJECT(ds), OBJECT(s), "enet", &local_err);
> +    if (local_err) {
> +        goto xilinx_enet_realize_fail;
> +    }
>      object_property_set_link(OBJECT(cs), OBJECT(s), "enet", &local_err);
>      if (local_err) {
>          goto xilinx_enet_realize_fail;
>      }
>
>      qemu_macaddr_default_if_unset(&s->conf.macaddr);
>      s->nic = qemu_new_nic(&net_xilinx_enet_info, &s->conf,
>                            object_get_typename(OBJECT(dev)), dev->id, s);
>      qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
>
>      tdk_init(&s->TEMAC.phy);
>      mdio_attach(&s->TEMAC.mdio_bus, &s->TEMAC.phy, s->c_phyaddr);
>
>      s->TEMAC.parent = s;
>
>      s->rxmem = g_malloc(s->c_rxmem);
>      return;
> --
> 2.21.1
>
>


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 12/12] hw/riscv/sifive_u: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 12/12] hw/riscv/sifive_u: " Philippe Mathieu-Daudé
@ 2020-03-25 20:52   ` Alistair Francis
  2020-03-26 21:55   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: Alistair Francis @ 2020-03-25 20:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, qemu-devel@nongnu.org Developers,
	Alistair Francis, Edgar E. Iglesias, Peter Maydell,
	Markus Armbruster, Aleksandar Markovic, open list:New World,
	Aleksandar Rikalo, Richard Henderson, Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, Palmer Dabbelt, Paolo Bonzini,
	Aurelien Jarno

On Wed, Mar 25, 2020 at 12:28 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/riscv/sifive_u.c:558:4]]
>   [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/riscv/sifive_u.c:561:4]]
>
> Add the missing error_propagate() after manual review.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/riscv/sifive_u.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> index 56351c4faa..01e44018cd 100644
> --- a/hw/riscv/sifive_u.c
> +++ b/hw/riscv/sifive_u.c
> @@ -473,113 +473,121 @@ static void riscv_sifive_u_machine_instance_init(Object *obj)
>  static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
>  {
>      MachineState *ms = MACHINE(qdev_get_machine());
>      SiFiveUSoCState *s = RISCV_U_SOC(dev);
>      const struct MemmapEntry *memmap = sifive_u_memmap;
>      MemoryRegion *system_memory = get_system_memory();
>      MemoryRegion *mask_rom = g_new(MemoryRegion, 1);
>      MemoryRegion *l2lim_mem = g_new(MemoryRegion, 1);
>      qemu_irq plic_gpios[SIFIVE_U_PLIC_NUM_SOURCES];
>      char *plic_hart_config;
>      size_t plic_hart_config_len;
>      int i;
>      Error *err = NULL;
>      NICInfo *nd = &nd_table[0];
>
>      object_property_set_bool(OBJECT(&s->e_cpus), true, "realized",
>                               &error_abort);
>      object_property_set_bool(OBJECT(&s->u_cpus), true, "realized",
>                               &error_abort);
>      /*
>       * The cluster must be realized after the RISC-V hart array container,
>       * as the container's CPU object is only created on realize, and the
>       * CPU must exist and have been parented into the cluster before the
>       * cluster is realized.
>       */
>      object_property_set_bool(OBJECT(&s->e_cluster), true, "realized",
>                               &error_abort);
>      object_property_set_bool(OBJECT(&s->u_cluster), true, "realized",
>                               &error_abort);
>
>      /* boot rom */
>      memory_region_init_rom(mask_rom, OBJECT(dev), "riscv.sifive.u.mrom",
>                             memmap[SIFIVE_U_MROM].size, &error_fatal);
>      memory_region_add_subregion(system_memory, memmap[SIFIVE_U_MROM].base,
>                                  mask_rom);
>
>      /*
>       * Add L2-LIM at reset size.
>       * This should be reduced in size as the L2 Cache Controller WayEnable
>       * register is incremented. Unfortunately I don't see a nice (or any) way
>       * to handle reducing or blocking out the L2 LIM while still allowing it
>       * be re returned to all enabled after a reset. For the time being, just
>       * leave it enabled all the time. This won't break anything, but will be
>       * too generous to misbehaving guests.
>       */
>      memory_region_init_ram(l2lim_mem, NULL, "riscv.sifive.u.l2lim",
>                             memmap[SIFIVE_U_L2LIM].size, &error_fatal);
>      memory_region_add_subregion(system_memory, memmap[SIFIVE_U_L2LIM].base,
>                                  l2lim_mem);
>
>      /* create PLIC hart topology configuration string */
>      plic_hart_config_len = (strlen(SIFIVE_U_PLIC_HART_CONFIG) + 1) *
>                             ms->smp.cpus;
>      plic_hart_config = g_malloc0(plic_hart_config_len);
>      for (i = 0; i < ms->smp.cpus; i++) {
>          if (i != 0) {
>              strncat(plic_hart_config, "," SIFIVE_U_PLIC_HART_CONFIG,
>                      plic_hart_config_len);
>          } else {
>              strncat(plic_hart_config, "M", plic_hart_config_len);
>          }
>          plic_hart_config_len -= (strlen(SIFIVE_U_PLIC_HART_CONFIG) + 1);
>      }
>
>      /* MMIO */
>      s->plic = sifive_plic_create(memmap[SIFIVE_U_PLIC].base,
>          plic_hart_config,
>          SIFIVE_U_PLIC_NUM_SOURCES,
>          SIFIVE_U_PLIC_NUM_PRIORITIES,
>          SIFIVE_U_PLIC_PRIORITY_BASE,
>          SIFIVE_U_PLIC_PENDING_BASE,
>          SIFIVE_U_PLIC_ENABLE_BASE,
>          SIFIVE_U_PLIC_ENABLE_STRIDE,
>          SIFIVE_U_PLIC_CONTEXT_BASE,
>          SIFIVE_U_PLIC_CONTEXT_STRIDE,
>          memmap[SIFIVE_U_PLIC].size);
>      g_free(plic_hart_config);
>      sifive_uart_create(system_memory, memmap[SIFIVE_U_UART0].base,
>          serial_hd(0), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_UART0_IRQ));
>      sifive_uart_create(system_memory, memmap[SIFIVE_U_UART1].base,
>          serial_hd(1), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_UART1_IRQ));
>      sifive_clint_create(memmap[SIFIVE_U_CLINT].base,
>          memmap[SIFIVE_U_CLINT].size, ms->smp.cpus,
>          SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE, false);
>
>      object_property_set_bool(OBJECT(&s->prci), true, "realized", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      sysbus_mmio_map(SYS_BUS_DEVICE(&s->prci), 0, memmap[SIFIVE_U_PRCI].base);
>
>      object_property_set_bool(OBJECT(&s->otp), true, "realized", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      sysbus_mmio_map(SYS_BUS_DEVICE(&s->otp), 0, memmap[SIFIVE_U_OTP].base);
>
>      for (i = 0; i < SIFIVE_U_PLIC_NUM_SOURCES; i++) {
>          plic_gpios[i] = qdev_get_gpio_in(DEVICE(s->plic), i);
>      }
>
>      if (nd->used) {
>          qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
>          qdev_set_nic_properties(DEVICE(&s->gem), nd);
>      }
>      object_property_set_int(OBJECT(&s->gem), GEM_REVISION, "revision",
>                              &error_abort);
>      object_property_set_bool(OBJECT(&s->gem), true, "realized", &err);
>      if (err) {
>          error_propagate(errp, err);
>          return;
>      }
>      sysbus_mmio_map(SYS_BUS_DEVICE(&s->gem), 0, memmap[SIFIVE_U_GEM].base);
>      sysbus_connect_irq(SYS_BUS_DEVICE(&s->gem), 0,
>                         plic_gpios[SIFIVE_U_GEM_IRQ]);
>
>      create_unimplemented_device("riscv.sifive.u.gem-mgmt",
>          memmap[SIFIVE_U_GEM_MGMT].base, memmap[SIFIVE_U_GEM_MGMT].size);
>  }
> --
> 2.21.1
>
>


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 10/12] hw/misc/macio/macio: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 10/12] hw/misc/macio/macio: " Philippe Mathieu-Daudé
@ 2020-03-25 23:55   ` David Gibson
  2020-03-26 21:50   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: David Gibson @ 2020-03-25 23:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Peter Maydell, Jason Wang,
	Mark Cave-Ayland, qemu-devel, Alistair Francis,
	Edgar E. Iglesias, Michael S. Tsirkin, Markus Armbruster,
	Aleksandar Markovic, Palmer Dabbelt, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, Richard Henderson,
	qemu-riscv, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno


[-- Attachment #1: Type: text/plain, Size: 5621 bytes --]

On Wed, Mar 25, 2020 at 08:18:28PM +0100, Philippe Mathieu-Daudé wrote:
> Running the coccinelle script produced:
> 
>   $ 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
> 
>   [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/misc/macio/macio.c:350:8]]
> 
> Add the missing error_propagate() after manual review.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/macio.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index 79222192e8..fffb64a7d5 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -292,98 +292,102 @@ static const MemoryRegionOps timer_ops = {
>  static void macio_newworld_realize(PCIDevice *d, Error **errp)
>  {
>      MacIOState *s = MACIO(d);
>      NewWorldMacIOState *ns = NEWWORLD_MACIO(d);
>      DeviceState *pic_dev = DEVICE(ns->pic);
>      Error *err = NULL;
>      SysBusDevice *sysbus_dev;
>      MemoryRegion *timer_memory = NULL;
>  
>      macio_common_realize(d, &err);
>      if (err) {
>          error_propagate(errp, err);
>          return;
>      }
>  
>      sysbus_dev = SYS_BUS_DEVICE(&s->escc);
>      sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
>                                                         NEWWORLD_ESCCB_IRQ));
>      sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev,
>                                                         NEWWORLD_ESCCA_IRQ));
>  
>      /* OpenPIC */
>      sysbus_dev = SYS_BUS_DEVICE(ns->pic);
>      memory_region_add_subregion(&s->bar, 0x40000,
>                                  sysbus_mmio_get_region(sysbus_dev, 0));
>  
>      /* IDE buses */
>      macio_realize_ide(s, &ns->ide[0],
>                        qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_IRQ),
>                        qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_DMA_IRQ),
>                        0x16, &err);
>      if (err) {
>          error_propagate(errp, err);
>          return;
>      }
>  
>      macio_realize_ide(s, &ns->ide[1],
>                        qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_IRQ),
>                        qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_DMA_IRQ),
>                        0x1a, &err);
>      if (err) {
>          error_propagate(errp, err);
>          return;
>      }
>  
>      /* Timer */
>      timer_memory = g_new(MemoryRegion, 1);
>      memory_region_init_io(timer_memory, OBJECT(s), &timer_ops, NULL, "timer",
>                            0x1000);
>      memory_region_add_subregion(&s->bar, 0x15000, timer_memory);
>  
>      if (ns->has_pmu) {
>          /* GPIOs */
>          sysbus_dev = SYS_BUS_DEVICE(&ns->gpio);
>          object_property_set_link(OBJECT(&ns->gpio), OBJECT(pic_dev), "pic",
>                                   &error_abort);
>          memory_region_add_subregion(&s->bar, 0x50,
>                                      sysbus_mmio_get_region(sysbus_dev, 0));
>          object_property_set_bool(OBJECT(&ns->gpio), true, "realized", &err);
> +        if (err) {
> +            error_propagate(errp, err);
> +            return;
> +        }
>  
>          /* PMU */
>          object_initialize_child(OBJECT(s), "pmu", &s->pmu, sizeof(s->pmu),
>                                  TYPE_VIA_PMU, &error_abort, NULL);
>          object_property_set_link(OBJECT(&s->pmu), OBJECT(sysbus_dev), "gpio",
>                                   &error_abort);
>          qdev_prop_set_bit(DEVICE(&s->pmu), "has-adb", ns->has_adb);
>          qdev_set_parent_bus(DEVICE(&s->pmu), BUS(&s->macio_bus));
>  
>          object_property_set_bool(OBJECT(&s->pmu), true, "realized", &err);
>          if (err) {
>              error_propagate(errp, err);
>              return;
>          }
>          sysbus_dev = SYS_BUS_DEVICE(&s->pmu);
>          sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
>                                                             NEWWORLD_PMU_IRQ));
>          memory_region_add_subregion(&s->bar, 0x16000,
>                                      sysbus_mmio_get_region(sysbus_dev, 0));
>      } else {
>          /* CUDA */
>          object_initialize_child(OBJECT(s), "cuda", &s->cuda, sizeof(s->cuda),
>                                  TYPE_CUDA, &error_abort, NULL);
>          qdev_set_parent_bus(DEVICE(&s->cuda), BUS(&s->macio_bus));
>          qdev_prop_set_uint64(DEVICE(&s->cuda), "timebase-frequency",
>                               s->frequency);
>  
>          object_property_set_bool(OBJECT(&s->cuda), true, "realized", &err);
>          if (err) {
>              error_propagate(errp, err);
>              return;
>          }
>          sysbus_dev = SYS_BUS_DEVICE(&s->cuda);
>          sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
>                                                             NEWWORLD_CUDA_IRQ));
>          memory_region_add_subregion(&s->bar, 0x16000,
>                                      sysbus_mmio_get_region(sysbus_dev, 0));
>      }
>  }

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 01/12] scripts/coccinelle: Add script to catch missing error_propagate() calls
  2020-03-25 19:18 ` [PATCH-for-5.0 01/12] scripts/coccinelle: Add script to catch missing error_propagate() calls Philippe Mathieu-Daudé
@ 2020-03-26 21:32   ` Peter Maydell
  0 siblings, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:18, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> In some places in we put an error into a local Error*, but forget
> to check for failure and pass it back to the caller.
> Add a Coccinelle patch to catch automatically add the missing code.
>
> Inspired-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---

This coccinelle script is impressively deep magic...
My general rule with cocci scripts is that if they serve
the purpose they're written for then that's sufficient
and they're not worth trying to polish further, but just
for my own education I have some questions below about how
this one works.

> +@match exists@
> +typedef Error;
> +Error *err;

I didn't realize you could do this kind of "this thing
must be this type" stuff in the metavariable declaration
section...

> +identifier func, errp;
> +identifier object_property_set_type1 =~ "^object_property_set_.*";
> +identifier object_property_set_type2 =~ "^object_property_set_.*";

If we relax this so that we just look for "anything that takes
an &err as its final argument" do we hit way too many false
positives ?

> +expression obj;
> +@@
> +void func(..., Error **errp)
> +{
> + <+...
> + object_property_set_type1(obj, ..., &err);
> + ... when != err

This 'when' clause means "match only when the code doesn't
touch 'err' anywhere between the two calls", right?

> + object_property_set_type2(obj, ..., &err);
> + ...+>
> +}
> +
> +@@
> +Error *match.err;
> +identifier match.errp;
> +identifier match.object_property_set_type1;
> +expression match.obj;
> +@@
> + object_property_set_type1(obj, ..., &err);
> ++if (err) {
> ++    error_propagate(errp, err);
> ++    return;
> ++}

Is there a reason we can't do the substitution
in the same rule we were using to find the match,
or was it just easier this way/done this way in
some other example you were following ?

> +
> +@manual depends on never match@
> +Error *err;
> +identifier object_property_set_type1 =~ "^object_property_set_.*";
> +identifier object_property_set_type2 =~ "^object_property_set_.*";
> +position p;
> +@@
> + object_property_set_type1@p(..., &err);
> + ... when != err
> + object_property_set_type2(..., &err);
> +
> +@script:python@
> +f << manual.object_property_set_type1;
> +p << manual.p;
> +@@
> +print("[[manual check required: "
> +      "error_propagate() might be missing in {}() {}:{}:{}]]".format(
> +            f, p[0].file, p[0].line, p[0].column))

Nice to have an example of how to do a "find these things
and print a diagnostic". This 'manual' match is handling
the cases where we got two consecutive uses of &err but
not in a function that took "Error *errp", yes?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 02/12] hw/arm/bcm2835_peripherals: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 02/12] hw/arm/bcm2835_peripherals: Add missing error-propagation code Philippe Mathieu-Daudé
@ 2020-03-26 21:34   ` Peter Maydell
  0 siblings, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:34 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:18, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Patch created mechanically by running:
>
>   $ spatch \
>     --macro-file scripts/cocci-macro-file.h --include-headers \
>     --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
>     --keep-comments --smpl-spacing --in-place --dir hw
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/arm/bcm2835_peripherals.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
> index edcaa4916d..a111e91069 100644
> --- a/hw/arm/bcm2835_peripherals.c
> +++ b/hw/arm/bcm2835_peripherals.c
> @@ -133,254 +133,262 @@ static void bcm2835_peripherals_init(Object *obj)
>  static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
>  {
>      BCM2835PeripheralState *s = BCM2835_PERIPHERALS(dev);
>      Object *obj;
>      MemoryRegion *ram;
>      Error *err = NULL;
>      uint64_t ram_size, vcram_size;
>      int n;

Is there a reason this patch has such an enormous amount of
context around the changes it's making ? It looks like it's
quoting the entire function.

Anyway
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 03/12] hw/arm/fsl-imx: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 03/12] hw/arm/fsl-imx: " Philippe Mathieu-Daudé
@ 2020-03-26 21:35   ` Peter Maydell
  0 siblings, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:18, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Patch created mechanically by running:
>
>   $ spatch \
>     --macro-file scripts/cocci-macro-file.h --include-headers \
>     --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
>     --keep-comments --smpl-spacing --in-place --dir hw
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 05/12] hw/i386/x86: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 05/12] hw/i386/x86: " Philippe Mathieu-Daudé
@ 2020-03-26 21:38   ` Peter Maydell
  0 siblings, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:38 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:18, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Patch created mechanically by running:
>
>   $ spatch \
>     --macro-file scripts/cocci-macro-file.h --include-headers \
>     --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
>     --keep-comments --smpl-spacing --in-place --dir hw
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/i386/x86.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index 87b73fe33c..0a4865d4a9 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -103,13 +103,17 @@ uint32_t x86_cpu_apic_id_from_index(X86MachineState *x86ms,
>  void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
>  {
>      Object *cpu = NULL;
>      Error *local_err = NULL;
>
>      cpu = object_new(MACHINE(x86ms)->cpu_type);
>
>      object_property_set_uint(cpu, apic_id, "apic-id", &local_err);
> +    if (local_err) {
> +        error_propagate(errp, local_err);
> +        return;
> +    }
>      object_property_set_bool(cpu, true, "realized", &local_err);
>
>      object_unref(cpu);
>      error_propagate(errp, local_err);
>  }

Hmm, not sure about this one -- in the error-exit path
for failure-to-realize we object_unref(), do we need to
do so also if we error-exit for failure to set the apic-id ?

(Since apic-id is a PROP_UINT32 with no set function, there
is not currently any way for the set_uint to fail, as it
happens. But we ought to either have the error-propagation
right or use error_abort if we truly believe it can never fail.)

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 07/12] hw/mips/cps: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 07/12] hw/mips/cps: " Philippe Mathieu-Daudé
@ 2020-03-26 21:43   ` Peter Maydell
  2020-03-26 22:48   ` Aleksandar Markovic
  1 sibling, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:18, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Patch created mechanically by running:
>
>   $ spatch \
>     --macro-file scripts/cocci-macro-file.h --include-headers \
>     --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
>     --keep-comments --smpl-spacing --in-place --dir hw
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/cps.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
>

>      /* Inter-Thread Communication Unit */
>      if (itu_present) {
>          sysbus_init_child_obj(OBJECT(dev), "itu", &s->itu, sizeof(s->itu),
>                                TYPE_MIPS_ITU);
>          object_property_set_int(OBJECT(&s->itu), 16, "num-fifo", &err);
> +        if (err) {
> +            error_propagate(errp, err);
> +            return;
> +        }
>          object_property_set_int(OBJECT(&s->itu), 16, "num-semaphores", &err);
> +        if (err) {
> +            error_propagate(errp, err);
> +            return;
> +        }
>          object_property_set_bool(OBJECT(&s->itu), saar_present, "saar-present",
>                                   &err);
> +        if (err) {
> +            error_propagate(errp, err);
> +            return;
> +        }
>          if (saar_present) {
>              s->itu.saar = &env->CP0_SAAR;
>          }
>          object_property_set_bool(OBJECT(&s->itu), true, "realized", &err);
> +        if (err) {
> +            error_propagate(errp, err);
> +            return;
> +        }
>          if (err != NULL) {
>              error_propagate(errp, err);
>              return;
>          }

I think Coccinelle has been fooled here by the slightly non-idiomatic
use of "err != NULL" in the guard and has inserted a duplicate
check...

>          memory_region_add_subregion(&s->container, 0,
>                             sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->itu), 0));
>      }
>
>      /* Cluster Power Controller */
>      sysbus_init_child_obj(OBJECT(dev), "cpc", &s->cpc, sizeof(s->cpc),
>                            TYPE_MIPS_CPC);
>      object_property_set_int(OBJECT(&s->cpc), s->num_vp, "num-vp", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_int(OBJECT(&s->cpc), 1, "vp-start-running", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_bool(OBJECT(&s->cpc), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }

...but oddly it gets it right here and in a couple of other cases
in this patch.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 04/12] hw/arm/stm32fx05_soc: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 04/12] hw/arm/stm32fx05_soc: " Philippe Mathieu-Daudé
  2020-03-25 20:51   ` Alistair Francis
@ 2020-03-26 21:45   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:45 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:18, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Patch created mechanically by running:
>
>   $ spatch \
>     --macro-file scripts/cocci-macro-file.h --include-headers \
>     --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
>     --keep-comments --smpl-spacing --in-place --dir hw
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/arm/stm32f205_soc.c | 4 ++++
>  hw/arm/stm32f405_soc.c | 4 ++++
>  2 files changed, 8 insertions(+)

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: " Philippe Mathieu-Daudé
  2020-03-25 20:52   ` Alistair Francis
@ 2020-03-26 21:46   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:46 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:18, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in object_property_set_link() hw//dma/xilinx_axidma.c:542:4]]
>
> Add the missing error_propagate() after manual review.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/dma/xilinx_axidma.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
> index 018f36991b..6e3406321c 100644
> --- a/hw/dma/xilinx_axidma.c
> +++ b/hw/dma/xilinx_axidma.c
> @@ -521,39 +521,42 @@ static const MemoryRegionOps axidma_ops = {
>  static void xilinx_axidma_realize(DeviceState *dev, Error **errp)
>  {
>      XilinxAXIDMA *s = XILINX_AXI_DMA(dev);
>      XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(&s->rx_data_dev);
>      XilinxAXIDMAStreamSlave *cs = XILINX_AXI_DMA_CONTROL_STREAM(
>                                                              &s->rx_control_dev);
>      Error *local_err = NULL;
>
>      object_property_add_link(OBJECT(ds), "dma", TYPE_XILINX_AXI_DMA,
>                               (Object **)&ds->dma,
>                               object_property_allow_set_link,
>                               OBJ_PROP_LINK_STRONG,
>                               &local_err);

Isn't there also a check on local_err missing here ?

>      object_property_add_link(OBJECT(cs), "dma", TYPE_XILINX_AXI_DMA,
>                               (Object **)&cs->dma,
>                               object_property_allow_set_link,
>                               OBJ_PROP_LINK_STRONG,
>                               &local_err);
>      if (local_err) {
>          goto xilinx_axidma_realize_fail;
>      }
>      object_property_set_link(OBJECT(ds), OBJECT(s), "dma", &local_err);
> +    if (local_err) {
> +        goto xilinx_axidma_realize_fail;
> +    }
>      object_property_set_link(OBJECT(cs), OBJECT(s), "dma", &local_err);
>      if (local_err) {
>          goto xilinx_axidma_realize_fail;
>      }

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 08/12] hw/mips/boston: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 08/12] hw/mips/boston: " Philippe Mathieu-Daudé
@ 2020-03-26 21:47   ` Peter Maydell
  2020-03-26 22:50   ` Aleksandar Markovic
  1 sibling, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:47 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:18, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in object_property_set_int() hw/mips/boston.c:462:4]]
>   [[manual check required: error_propagate() might be missing in object_property_set_str() hw/mips/boston.c:460:4]]
>
> Since the uses are inside a MachineClass::init() function,
> directly use &error_fatal instead of error_propagate().
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 09/12] hw/mips/mips_malta: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 09/12] hw/mips/mips_malta: " Philippe Mathieu-Daudé
@ 2020-03-26 21:49   ` Peter Maydell
  2020-03-26 22:49   ` Aleksandar Markovic
  1 sibling, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:19, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in object_property_set_int() hw/mips/mips_malta.c:1193:4]]
>   [[manual check required: error_propagate() might be missing in object_property_set_str() hw/mips/mips_malta.c:1192:4]]
>
> Add the missing error_propagate() after manual review by adding
> a Error* parameter to create_cps().
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/mips_malta.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 10/12] hw/misc/macio/macio: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 10/12] hw/misc/macio/macio: " Philippe Mathieu-Daudé
  2020-03-25 23:55   ` David Gibson
@ 2020-03-26 21:50   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:19, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/misc/macio/macio.c:350:8]]
>
> Add the missing error_propagate() after manual review.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: " Philippe Mathieu-Daudé
  2020-03-25 20:52   ` Alistair Francis
@ 2020-03-26 21:51   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:19, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in object_property_set_link() hw/net/xilinx_axienet.c:969:4]]
>
> Add the missing error_propagate() after manual review.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/net/xilinx_axienet.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
> index 704788811a..f11510a71e 100644
> --- a/hw/net/xilinx_axienet.c
> +++ b/hw/net/xilinx_axienet.c
> @@ -948,39 +948,42 @@ static NetClientInfo net_xilinx_enet_info = {
>  static void xilinx_enet_realize(DeviceState *dev, Error **errp)
>  {
>      XilinxAXIEnet *s = XILINX_AXI_ENET(dev);
>      XilinxAXIEnetStreamSlave *ds = XILINX_AXI_ENET_DATA_STREAM(&s->rx_data_dev);
>      XilinxAXIEnetStreamSlave *cs = XILINX_AXI_ENET_CONTROL_STREAM(
>                                                              &s->rx_control_dev);
>      Error *local_err = NULL;
>
>      object_property_add_link(OBJECT(ds), "enet", "xlnx.axi-ethernet",
>                               (Object **) &ds->enet,
>                               object_property_allow_set_link,
>                               OBJ_PROP_LINK_STRONG,
>                               &local_err);

Again, Coccinelle seems to have not spotted the missing error check here...

>      object_property_add_link(OBJECT(cs), "enet", "xlnx.axi-ethernet",
>                               (Object **) &cs->enet,
>                               object_property_allow_set_link,
>                               OBJ_PROP_LINK_STRONG,
>                               &local_err);
>      if (local_err) {
>          goto xilinx_enet_realize_fail;
>      }
>      object_property_set_link(OBJECT(ds), OBJECT(s), "enet", &local_err);
> +    if (local_err) {
> +        goto xilinx_enet_realize_fail;
> +    }
>      object_property_set_link(OBJECT(cs), OBJECT(s), "enet", &local_err);
>      if (local_err) {
>          goto xilinx_enet_realize_fail;
>      }

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 12/12] hw/riscv/sifive_u: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 12/12] hw/riscv/sifive_u: " Philippe Mathieu-Daudé
  2020-03-25 20:52   ` Alistair Francis
@ 2020-03-26 21:55   ` Peter Maydell
  2020-03-31 17:02     ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 41+ messages in thread
From: Peter Maydell @ 2020-03-26 21:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On Wed, 25 Mar 2020 at 19:19, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/riscv/sifive_u.c:558:4]]
>   [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/riscv/sifive_u.c:561:4]]
>
> Add the missing error_propagate() after manual review.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/riscv/sifive_u.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> index 56351c4faa..01e44018cd 100644
> --- a/hw/riscv/sifive_u.c
> +++ b/hw/riscv/sifive_u.c
> @@ -473,113 +473,121 @@ static void riscv_sifive_u_machine_instance_init(Object *obj)
>  static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
>  {
>      MachineState *ms = MACHINE(qdev_get_machine());
>      SiFiveUSoCState *s = RISCV_U_SOC(dev);
>      const struct MemmapEntry *memmap = sifive_u_memmap;
>      MemoryRegion *system_memory = get_system_memory();
>      MemoryRegion *mask_rom = g_new(MemoryRegion, 1);
>      MemoryRegion *l2lim_mem = g_new(MemoryRegion, 1);
>      qemu_irq plic_gpios[SIFIVE_U_PLIC_NUM_SOURCES];
>      char *plic_hart_config;
>      size_t plic_hart_config_len;
>      int i;
>      Error *err = NULL;
>      NICInfo *nd = &nd_table[0];
>
>      object_property_set_bool(OBJECT(&s->e_cpus), true, "realized",
>                               &error_abort);
>      object_property_set_bool(OBJECT(&s->u_cpus), true, "realized",
>                               &error_abort);
>      /*
>       * The cluster must be realized after the RISC-V hart array container,
>       * as the container's CPU object is only created on realize, and the
>       * CPU must exist and have been parented into the cluster before the
>       * cluster is realized.
>       */
>      object_property_set_bool(OBJECT(&s->e_cluster), true, "realized",
>                               &error_abort);
>      object_property_set_bool(OBJECT(&s->u_cluster), true, "realized",
>                               &error_abort);

Different bug noticed in passing: these really ought not to be
using error_abort to realize things, as realize is a fairly
likely-to-fail operation on most objects (either now or in
the future if the object implementation changes).

>
>      /* boot rom */
>      memory_region_init_rom(mask_rom, OBJECT(dev), "riscv.sifive.u.mrom",
>                             memmap[SIFIVE_U_MROM].size, &error_fatal);
>      memory_region_add_subregion(system_memory, memmap[SIFIVE_U_MROM].base,
>                                  mask_rom);

>      object_property_set_bool(OBJECT(&s->prci), true, "realized", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      sysbus_mmio_map(SYS_BUS_DEVICE(&s->prci), 0, memmap[SIFIVE_U_PRCI].base);
>
>      object_property_set_bool(OBJECT(&s->otp), true, "realized", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }

The changes made in this patch are fine though:
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 07/12] hw/mips/cps: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 07/12] hw/mips/cps: " Philippe Mathieu-Daudé
  2020-03-26 21:43   ` Peter Maydell
@ 2020-03-26 22:48   ` Aleksandar Markovic
  1 sibling, 0 replies; 41+ messages in thread
From: Aleksandar Markovic @ 2020-03-26 22:48 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Peter Maydell, Markus Armbruster,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno


[-- Attachment #1: Type: text/plain, Size: 6128 bytes --]

21:18 Sre, 25.03.2020. Philippe Mathieu-Daudé <f4bug@amsat.org> је
написао/ла:
>
> Patch created mechanically by running:
>
>   $ spatch \
>     --macro-file scripts/cocci-macro-file.h --include-headers \
>     --sp-file
scripts/coccinelle/object_property_missing_error_propagate.cocci \
>     --keep-comments --smpl-spacing --in-place --dir hw
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/cps.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
>
> diff --git a/hw/mips/cps.c b/hw/mips/cps.c
> index 92b9b1a5f6..d682633401 100644
> --- a/hw/mips/cps.c
> +++ b/hw/mips/cps.c
> @@ -68,100 +68,152 @@ static bool cpu_mips_itu_supported(CPUMIPSState
*env)
>  static void mips_cps_realize(DeviceState *dev, Error **errp)
>  {
>      MIPSCPSState *s = MIPS_CPS(dev);
>      CPUMIPSState *env;
>      MIPSCPU *cpu;
>      int i;
>      Error *err = NULL;
>      target_ulong gcr_base;
>      bool itu_present = false;
>      bool saar_present = false;
>
>      for (i = 0; i < s->num_vp; i++) {
>          cpu = MIPS_CPU(cpu_create(s->cpu_type));
>
>          /* Init internal devices */
>          cpu_mips_irq_init_cpu(cpu);
>          cpu_mips_clock_init(cpu);
>
>          env = &cpu->env;
>          if (cpu_mips_itu_supported(env)) {
>              itu_present = true;
>              /* Attach ITC Tag to the VP */
>              env->itc_tag = mips_itu_get_tag_region(&s->itu);
>              env->itu = &s->itu;
>          }
>          qemu_register_reset(main_cpu_reset, cpu);
>      }
>
>      cpu = MIPS_CPU(first_cpu);
>      env = &cpu->env;
>      saar_present = (bool)env->saarp;
>
>      /* Inter-Thread Communication Unit */
>      if (itu_present) {
>          sysbus_init_child_obj(OBJECT(dev), "itu", &s->itu,
sizeof(s->itu),
>                                TYPE_MIPS_ITU);
>          object_property_set_int(OBJECT(&s->itu), 16, "num-fifo", &err);
> +        if (err) {
> +            error_propagate(errp, err);
> +            return;
> +        }
>          object_property_set_int(OBJECT(&s->itu), 16, "num-semaphores",
&err);
> +        if (err) {
> +            error_propagate(errp, err);
> +            return;
> +        }
>          object_property_set_bool(OBJECT(&s->itu), saar_present,
"saar-present",
>                                   &err);
> +        if (err) {
> +            error_propagate(errp, err);
> +            return;
> +        }
>          if (saar_present) {
>              s->itu.saar = &env->CP0_SAAR;
>          }
>          object_property_set_bool(OBJECT(&s->itu), true, "realized",
&err);
> +        if (err) {
> +            error_propagate(errp, err);
> +            return;
> +        }
>          if (err != NULL) {
>              error_propagate(errp, err);
>              return;
>          }
>
>          memory_region_add_subregion(&s->container, 0,
>
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->itu), 0));
>      }
>
>      /* Cluster Power Controller */
>      sysbus_init_child_obj(OBJECT(dev), "cpc", &s->cpc, sizeof(s->cpc),
>                            TYPE_MIPS_CPC);
>      object_property_set_int(OBJECT(&s->cpc), s->num_vp, "num-vp", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_int(OBJECT(&s->cpc), 1, "vp-start-running",
&err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_bool(OBJECT(&s->cpc), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>
>      memory_region_add_subregion(&s->container, 0,
>
 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->cpc), 0));
>
>      /* Global Interrupt Controller */
>      sysbus_init_child_obj(OBJECT(dev), "gic", &s->gic, sizeof(s->gic),
>                            TYPE_MIPS_GIC);
>      object_property_set_int(OBJECT(&s->gic), s->num_vp, "num-vp", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_int(OBJECT(&s->gic), 128, "num-irq", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_bool(OBJECT(&s->gic), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>
>      memory_region_add_subregion(&s->container, 0,
>
 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gic), 0));
>
>      /* Global Configuration Registers */
>      gcr_base = env->CP0_CMGCRBase << 4;
>
>      sysbus_init_child_obj(OBJECT(dev), "gcr", &s->gcr, sizeof(s->gcr),
>                            TYPE_MIPS_GCR);
>      object_property_set_int(OBJECT(&s->gcr), s->num_vp, "num-vp", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_int(OBJECT(&s->gcr), 0x800, "gcr-rev", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_int(OBJECT(&s->gcr), gcr_base, "gcr-base", &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_link(OBJECT(&s->gcr), OBJECT(&s->gic.mr), "gic",
&err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_link(OBJECT(&s->gcr), OBJECT(&s->cpc.mr), "cpc",
&err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_bool(OBJECT(&s->gcr), true, "realized", &err);
>      if (err != NULL) {
>          error_propagate(errp, err);
>          return;
>      }
>
>      memory_region_add_subregion(&s->container, gcr_base,
>
 sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gcr), 0));
>  }
> --
> 2.21.1
>

If you remove the duplicate check that Peter spotted:

Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>

[-- Attachment #2: Type: text/html, Size: 8904 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 09/12] hw/mips/mips_malta: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 09/12] hw/mips/mips_malta: " Philippe Mathieu-Daudé
  2020-03-26 21:49   ` Peter Maydell
@ 2020-03-26 22:49   ` Aleksandar Markovic
  1 sibling, 0 replies; 41+ messages in thread
From: Aleksandar Markovic @ 2020-03-26 22:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Peter Maydell, Markus Armbruster,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno


[-- Attachment #1: Type: text/plain, Size: 2904 bytes --]

21:19 Sre, 25.03.2020. Philippe Mathieu-Daudé <f4bug@amsat.org> је
написао/ла:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in
object_property_set_int() hw/mips/mips_malta.c:1193:4]]
>   [[manual check required: error_propagate() might be missing in
object_property_set_str() hw/mips/mips_malta.c:1192:4]]
>
> Add the missing error_propagate() after manual review by adding
> a Error* parameter to create_cps().
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/mips_malta.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index e4c4de1b4e..8d43cfd41b 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1183,22 +1183,31 @@ static void create_cpu_without_cps(MachineState
*ms,
>  }
>
>  static void create_cps(MachineState *ms, MaltaState *s,
> -                       qemu_irq *cbus_irq, qemu_irq *i8259_irq)
> +                       qemu_irq *cbus_irq, qemu_irq *i8259_irq,
> +                       Error **errp)
>  {
>      Error *err = NULL;
>
>      sysbus_init_child_obj(OBJECT(s), "cps", OBJECT(&s->cps),
sizeof(s->cps),
>                            TYPE_MIPS_CPS);
>      object_property_set_str(OBJECT(&s->cps), ms->cpu_type, "cpu-type",
&err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_int(OBJECT(&s->cps), ms->smp.cpus, "num-vp",
&err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
> +    }
>      object_property_set_bool(OBJECT(&s->cps), true, "realized", &err);
> -    if (err != NULL) {
> -        error_report("%s", error_get_pretty(err));
> -        exit(1);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;
>      }
>
>      sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
>
>      *i8259_irq = get_cps_irq(&s->cps, 3);
>      *cbus_irq = NULL;
>  }
> @@ -1206,9 +1215,9 @@ static void create_cps(MachineState *ms, MaltaState
*s,
>  static void mips_create_cpu(MachineState *ms, MaltaState *s,
>                              qemu_irq *cbus_irq, qemu_irq *i8259_irq)
>  {
>      if ((ms->smp.cpus > 1) && cpu_supports_cps_smp(ms->cpu_type)) {
> -        create_cps(ms, s, cbus_irq, i8259_irq);
> +        create_cps(ms, s, cbus_irq, i8259_irq, &error_fatal);
>      } else {
>          create_cpu_without_cps(ms, cbus_irq, i8259_irq);
>      }
>  }
> --
> 2.21.1
>

Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>

[-- Attachment #2: Type: text/html, Size: 3894 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 08/12] hw/mips/boston: Add missing error-propagation code
  2020-03-25 19:18 ` [PATCH-for-5.0 08/12] hw/mips/boston: " Philippe Mathieu-Daudé
  2020-03-26 21:47   ` Peter Maydell
@ 2020-03-26 22:50   ` Aleksandar Markovic
  1 sibling, 0 replies; 41+ messages in thread
From: Aleksandar Markovic @ 2020-03-26 22:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Peter Maydell, Markus Armbruster,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno


[-- Attachment #1: Type: text/plain, Size: 6523 bytes --]

21:18 Sre, 25.03.2020. Philippe Mathieu-Daudé <f4bug@amsat.org> је
написао/ла:
>
> Running the coccinelle script produced:
>
>   $ 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
>
>   [[manual check required: error_propagate() might be missing in
object_property_set_int() hw/mips/boston.c:462:4]]
>   [[manual check required: error_propagate() might be missing in
object_property_set_str() hw/mips/boston.c:460:4]]
>
> Since the uses are inside a MachineClass::init() function,
> directly use &error_fatal instead of error_propagate().
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/boston.c | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/hw/mips/boston.c b/hw/mips/boston.c
> index 98ecd25e8e..2e821ca7d6 100644
> --- a/hw/mips/boston.c
> +++ b/hw/mips/boston.c
> @@ -425,121 +425,116 @@ xilinx_pcie_init(MemoryRegion *sys_mem, uint32_t
bus_nr,
>  static void boston_mach_init(MachineState *machine)
>  {
>      DeviceState *dev;
>      BostonState *s;
> -    Error *err = NULL;
>      MemoryRegion *flash, *ddr_low_alias, *lcd, *platreg;
>      MemoryRegion *sys_mem = get_system_memory();
>      XilinxPCIEHost *pcie2;
>      PCIDevice *ahci;
>      DriveInfo *hd[6];
>      Chardev *chr;
>      int fw_size, fit_err;
>      bool is_64b;
>
>      if ((machine->ram_size % GiB) ||
>          (machine->ram_size > (2 * GiB))) {
>          error_report("Memory size must be 1GB or 2GB");
>          exit(1);
>      }
>
>      dev = qdev_create(NULL, TYPE_MIPS_BOSTON);
>      qdev_init_nofail(dev);
>
>      s = BOSTON(dev);
>      s->mach = machine;
>
>      if (!cpu_supports_cps_smp(machine->cpu_type)) {
>          error_report("Boston requires CPUs which support CPS");
>          exit(1);
>      }
>
>      is_64b = cpu_supports_isa(machine->cpu_type, ISA_MIPS64);
>
>      sysbus_init_child_obj(OBJECT(machine), "cps", OBJECT(&s->cps),
>                            sizeof(s->cps), TYPE_MIPS_CPS);
>      object_property_set_str(OBJECT(&s->cps), machine->cpu_type,
"cpu-type",
> -                            &err);
> -    object_property_set_int(OBJECT(&s->cps), machine->smp.cpus,
"num-vp", &err);
> -    object_property_set_bool(OBJECT(&s->cps), true, "realized", &err);
> -
> -    if (err != NULL) {
> -        error_report("%s", error_get_pretty(err));
> -        exit(1);
> -    }
> -
> +                            &error_fatal);
> +    object_property_set_int(OBJECT(&s->cps), machine->smp.cpus, "num-vp",
> +                            &error_fatal);
> +    object_property_set_bool(OBJECT(&s->cps), true, "realized",
&error_fatal);
>      sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
>
>      flash =  g_new(MemoryRegion, 1);
> -    memory_region_init_rom(flash, NULL, "boston.flash", 128 * MiB, &err);
> +    memory_region_init_rom(flash, NULL, "boston.flash", 128 * MiB,
> +                           &error_fatal);
>      memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0);
>
>      memory_region_add_subregion_overlap(sys_mem, 0x80000000,
machine->ram, 0);
>
>      ddr_low_alias = g_new(MemoryRegion, 1);
>      memory_region_init_alias(ddr_low_alias, NULL, "boston_low.ddr",
>                               machine->ram, 0,
>                               MIN(machine->ram_size, (256 * MiB)));
>      memory_region_add_subregion_overlap(sys_mem, 0, ddr_low_alias, 0);
>
>      xilinx_pcie_init(sys_mem, 0,
>                       0x10000000, 32 * MiB,
>                       0x40000000, 1 * GiB,
>                       get_cps_irq(&s->cps, 2), false);
>
>      xilinx_pcie_init(sys_mem, 1,
>                       0x12000000, 32 * MiB,
>                       0x20000000, 512 * MiB,
>                       get_cps_irq(&s->cps, 1), false);
>
>      pcie2 = xilinx_pcie_init(sys_mem, 2,
>                               0x14000000, 32 * MiB,
>                               0x16000000, 1 * MiB,
>                               get_cps_irq(&s->cps, 0), true);
>
>      platreg = g_new(MemoryRegion, 1);
>      memory_region_init_io(platreg, NULL, &boston_platreg_ops, s,
>                            "boston-platregs", 0x1000);
>      memory_region_add_subregion_overlap(sys_mem, 0x17ffd000, platreg, 0);
>
>      s->uart = serial_mm_init(sys_mem, 0x17ffe000, 2,
>                               get_cps_irq(&s->cps, 3), 10000000,
>                               serial_hd(0), DEVICE_NATIVE_ENDIAN);
>
>      lcd = g_new(MemoryRegion, 1);
>      memory_region_init_io(lcd, NULL, &boston_lcd_ops, s, "boston-lcd",
0x8);
>      memory_region_add_subregion_overlap(sys_mem, 0x17fff000, lcd, 0);
>
>      chr = qemu_chr_new("lcd", "vc:320x240", NULL);
>      qemu_chr_fe_init(&s->lcd_display, chr, NULL);
>      qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,
>                               boston_lcd_event, NULL, s, NULL, true);
>
>      ahci =
pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
>                                             PCI_DEVFN(0, 0),
>                                             true, TYPE_ICH9_AHCI);
>      g_assert(ARRAY_SIZE(hd) == ahci_get_num_ports(ahci));
>      ide_drive_get(hd, ahci_get_num_ports(ahci));
>      ahci_ide_create_devs(ahci, hd);
>
>      if (machine->firmware) {
>          fw_size = load_image_targphys(machine->firmware,
>                                        0x1fc00000, 4 * MiB);
>          if (fw_size == -1) {
>              error_report("unable to load firmware image '%s'",
>                            machine->firmware);
>              exit(1);
>          }
>      } else if (machine->kernel_filename) {
>          fit_err = load_fit(&boston_fit_loader, machine->kernel_filename,
s);
>          if (fit_err) {
>              error_report("unable to load FIT image");
>              exit(1);
>          }
>
>          gen_firmware(memory_region_get_ram_ptr(flash) + 0x7c00000,
>                       s->kernel_entry, s->fdt_base, is_64b);
>      } else if (!qtest_enabled()) {
>          error_report("Please provide either a -kernel or -bios
argument");
>          exit(1);
>      }
>  }
> --
> 2.21.1
>

Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>

[-- Attachment #2: Type: text/html, Size: 8854 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 00/12] hw: Add missing error-propagation code
  2020-03-25 19:20 ` [PATCH-for-5.0 00/12] hw: " Philippe Mathieu-Daudé
@ 2020-03-30  9:21   ` Stefan Hajnoczi
  2020-04-06 17:47     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 41+ messages in thread
From: Stefan Hajnoczi @ 2020-03-30  9:21 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, qemu-devel@nongnu.org Developers,
	Alistair Francis, Edgar E. Iglesias, Peter Maydell,
	Markus Armbruster, Aleksandar Markovic, Palmer Dabbelt,
	Aleksandar Rikalo, Richard Henderson, Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc@nongnu.org list:PowerPC,
	Paolo Bonzini, Aurelien Jarno


[-- Attachment #1: Type: text/plain, Size: 991 bytes --]

On Wed, Mar 25, 2020 at 08:20:49PM +0100, Philippe Mathieu-Daudé wrote:
> On Wed, Mar 25, 2020 at 8:18 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> >
> > This series is inspired of Peter fix:
> > "hw/arm/xlnx-zynqmp.c: fix some error-handling code"
> > https://www.mail-archive.com/qemu-devel@nongnu.org/msg691636.html
> >
> > Add a cocci script to fix the other places.
> >
> > Based-on: <20200324134947.15384-1-peter.maydell@linaro.org>
> >
> > Philippe Mathieu-Daud=C3=A9 (12):
> 
> Hmm is that a git-publish bug?

Please run git-publish once more on the same branch and inspect the
$TMPDIR/0000-cover-letter.patch email in an editor when git-publish
prints "Stopping so you can inspect the patch emails:".

It would be interesting to see how your name is formatted, as well as
the MIME Content-Type and Content-Transfer-Encoding headers.

This information can be compared to the final email sent to the list
and/or received by the mailing list.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 00/12] hw: Add missing error-propagation code
  2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
                   ` (12 preceding siblings ...)
  2020-03-25 19:20 ` [PATCH-for-5.0 00/12] hw: " Philippe Mathieu-Daudé
@ 2020-03-31 13:23 ` Markus Armbruster
  2020-04-03 17:53   ` Philippe Mathieu-Daudé
  13 siblings, 1 reply; 41+ messages in thread
From: Markus Armbruster @ 2020-03-31 13:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, qemu-devel, Alistair Francis,
	Edgar E. Iglesias, Peter Maydell, Aleksandar Markovic, qemu-ppc,
	Aleksandar Rikalo, Richard Henderson, Philippe Mathieu-Daudé,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, Palmer Dabbelt, Paolo Bonzini,
	Aurelien Jarno

Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> This series is inspired of Peter fix:
> "hw/arm/xlnx-zynqmp.c: fix some error-handling code"
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg691636.html
>
> Add a cocci script to fix the other places.
>
> Based-on: <20200324134947.15384-1-peter.maydell@linaro.org>

I skimmed the code patches [PATCH 02-12/12], and they look like bug
fixes.  Other reviewers raised a few issues.

I also skimmed the Coccinelle script [PATCH 01].  Peter pointed out a
few things it apparently missed (e.g. in review of PATCH 06+11).
Moreover, the bug pattern applies beyond object_property_set() &
friends.  Perhaps the script can be generalized.  No reason to hold
fixes.  We may want to add suitable notes to the scipt, though.

Can you address the reviews in a v2, so we can get the fixes into -rc1,
due today?



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 12/12] hw/riscv/sifive_u: Add missing error-propagation code
  2020-03-26 21:55   ` Peter Maydell
@ 2020-03-31 17:02     ` Philippe Mathieu-Daudé
  2020-03-31 17:03       ` Peter Maydell
  0 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-31 17:02 UTC (permalink / raw)
  To: Peter Maydell, Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On 3/26/20 10:55 PM, Peter Maydell wrote:
> On Wed, 25 Mar 2020 at 19:19, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>>
>> Running the coccinelle script produced:
>>
>>    $ 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
>>
>>    [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/riscv/sifive_u.c:558:4]]
>>    [[manual check required: error_propagate() might be missing in object_property_set_bool() hw/riscv/sifive_u.c:561:4]]
>>
>> Add the missing error_propagate() after manual review.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   hw/riscv/sifive_u.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
>> index 56351c4faa..01e44018cd 100644
>> --- a/hw/riscv/sifive_u.c
>> +++ b/hw/riscv/sifive_u.c
>> @@ -473,113 +473,121 @@ static void riscv_sifive_u_machine_instance_init(Object *obj)
>>   static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
>>   {
>>       MachineState *ms = MACHINE(qdev_get_machine());
>>       SiFiveUSoCState *s = RISCV_U_SOC(dev);
>>       const struct MemmapEntry *memmap = sifive_u_memmap;
>>       MemoryRegion *system_memory = get_system_memory();
>>       MemoryRegion *mask_rom = g_new(MemoryRegion, 1);
>>       MemoryRegion *l2lim_mem = g_new(MemoryRegion, 1);
>>       qemu_irq plic_gpios[SIFIVE_U_PLIC_NUM_SOURCES];
>>       char *plic_hart_config;
>>       size_t plic_hart_config_len;
>>       int i;
>>       Error *err = NULL;
>>       NICInfo *nd = &nd_table[0];
>>
>>       object_property_set_bool(OBJECT(&s->e_cpus), true, "realized",
>>                                &error_abort);
>>       object_property_set_bool(OBJECT(&s->u_cpus), true, "realized",
>>                                &error_abort);
>>       /*
>>        * The cluster must be realized after the RISC-V hart array container,
>>        * as the container's CPU object is only created on realize, and the
>>        * CPU must exist and have been parented into the cluster before the
>>        * cluster is realized.
>>        */
>>       object_property_set_bool(OBJECT(&s->e_cluster), true, "realized",
>>                                &error_abort);
>>       object_property_set_bool(OBJECT(&s->u_cluster), true, "realized",
>>                                &error_abort);
> 
> Different bug noticed in passing: these really ought not to be
> using error_abort to realize things, as realize is a fairly
> likely-to-fail operation on most objects (either now or in
> the future if the object implementation changes).

OK.

> 
>>
>>       /* boot rom */
>>       memory_region_init_rom(mask_rom, OBJECT(dev), "riscv.sifive.u.mrom",
>>                              memmap[SIFIVE_U_MROM].size, &error_fatal);

What about this memory_region_init_rom() call (and later 
memory_region_init_ram) using error_fatal, same reasoning right?

>>       memory_region_add_subregion(system_memory, memmap[SIFIVE_U_MROM].base,
>>                                   mask_rom);
> 
>>       object_property_set_bool(OBJECT(&s->prci), true, "realized", &err);
>> +    if (err) {
>> +        error_propagate(errp, err);
>> +        return;
>> +    }
>>       sysbus_mmio_map(SYS_BUS_DEVICE(&s->prci), 0, memmap[SIFIVE_U_PRCI].base);
>>
>>       object_property_set_bool(OBJECT(&s->otp), true, "realized", &err);
>> +    if (err) {
>> +        error_propagate(errp, err);
>> +        return;
>> +    }
> 
> The changes made in this patch are fine though:
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> thanks
> -- PMM
> 



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 12/12] hw/riscv/sifive_u: Add missing error-propagation code
  2020-03-31 17:02     ` Philippe Mathieu-Daudé
@ 2020-03-31 17:03       ` Peter Maydell
  0 siblings, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2020-03-31 17:03 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, QEMU Developers, Alistair Francis,
	Edgar E. Iglesias, Markus Armbruster, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	open list:RISC-V, Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

On Tue, 31 Mar 2020 at 18:02, Philippe Mathieu-Daudé <philmd@redhat.com> wrote
> What about this memory_region_init_rom() call (and later
> memory_region_init_ram) using error_fatal, same reasoning right?

Yes.

-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 00/12] hw: Add missing error-propagation code
  2020-03-31 13:23 ` Markus Armbruster
@ 2020-04-03 17:53   ` Philippe Mathieu-Daudé
  2020-04-04  5:55     ` Markus Armbruster
  0 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-03 17:53 UTC (permalink / raw)
  To: Markus Armbruster, Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, qemu-devel, Alistair Francis,
	Edgar E. Iglesias, Peter Maydell, Aleksandar Markovic,
	Palmer Dabbelt, Aleksandar Rikalo, Richard Henderson,
	Eduardo Habkost, Alistair Francis, qemu-arm, David Gibson,
	qemu-riscv, Bastian Koppelmann, Andrew Baumann,
	Jean-Christophe Dubois, qemu-ppc, Paolo Bonzini, Aurelien Jarno

Hi Markus, Peter.

On 3/31/20 3:23 PM, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> 
>> This series is inspired of Peter fix:
>> "hw/arm/xlnx-zynqmp.c: fix some error-handling code"
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg691636.html
>>
>> Add a cocci script to fix the other places.
>>
>> Based-on: <20200324134947.15384-1-peter.maydell@linaro.org>
> 
> I skimmed the code patches [PATCH 02-12/12], and they look like bug
> fixes.  Other reviewers raised a few issues.
> 
> I also skimmed the Coccinelle script [PATCH 01].  Peter pointed out a
> few things it apparently missed (e.g. in review of PATCH 06+11).
> Moreover, the bug pattern applies beyond object_property_set() &
> friends.  Perhaps the script can be generalized.  No reason to hold
> fixes.  We may want to add suitable notes to the scipt, though.
> 
> Can you address the reviews in a v2, so we can get the fixes into -rc1,
> due today?

Status on this series (sorry I didn't update earlier).

I addressed Peter's comments, improved/simplified/documented the cocci 
script (which I split in smaller ones).

Peter suggested other functions can be checked too, not only the 
"^object_property_set_.*" matches. Indeed, more patches added. Some are big.

Another suggestion is replace in init() 'NULL' Error* final argument by 
&error_abort. This can be another series on top.
However I noticed we can reduce the error_propagate() generated calls in 
many places, when both init()/realize() exist and the property set is 
not dependent of parent operation, by moving these calls from realize() 
to init(). Another cocci script. But to make sense it has to be run 
previous the "add missing error_propagate" one.

While writing the cocci patches, I had 3 different Coccinelle failures.
Failures not due to a spatch bug, but timeout because C source hard to 
process. Indeed the C source code was dubious, could get some 
simplification rewrite. Then spatch could transform them. More patches 
in the middle.

Now I'm at 47 patches, the reviewed patches at the end of the series.
Too much for RC2. Since I don't think these are critical bugs, but 
improvements, are you OK to postpone this series to 5.1?

If you think a patch deserves to be in 5.0, point me at it and I can 
send it ASAP with comments addressed. Else I'll post my series as 
-for-5.1 soon.

Regards,

Phil.



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 00/12] hw: Add missing error-propagation code
  2020-04-03 17:53   ` Philippe Mathieu-Daudé
@ 2020-04-04  5:55     ` Markus Armbruster
  0 siblings, 0 replies; 41+ messages in thread
From: Markus Armbruster @ 2020-04-04  5:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, qemu-devel, Alistair Francis,
	Edgar E. Iglesias, Peter Maydell, Aleksandar Markovic, qemu-ppc,
	Aleksandar Rikalo, Richard Henderson, Eduardo Habkost,
	Alistair Francis, qemu-arm, David Gibson, qemu-riscv,
	Bastian Koppelmann, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, Palmer Dabbelt,
	Paolo Bonzini, Aurelien Jarno

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Hi Markus, Peter.
>
> On 3/31/20 3:23 PM, Markus Armbruster wrote:
>> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
>>
>>> This series is inspired of Peter fix:
>>> "hw/arm/xlnx-zynqmp.c: fix some error-handling code"
>>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg691636.html
>>>
>>> Add a cocci script to fix the other places.
>>>
>>> Based-on: <20200324134947.15384-1-peter.maydell@linaro.org>
>>
>> I skimmed the code patches [PATCH 02-12/12], and they look like bug
>> fixes.  Other reviewers raised a few issues.
>>
>> I also skimmed the Coccinelle script [PATCH 01].  Peter pointed out a
>> few things it apparently missed (e.g. in review of PATCH 06+11).
>> Moreover, the bug pattern applies beyond object_property_set() &
>> friends.  Perhaps the script can be generalized.  No reason to hold
>> fixes.  We may want to add suitable notes to the scipt, though.
>>
>> Can you address the reviews in a v2, so we can get the fixes into -rc1,
>> due today?
>
> Status on this series (sorry I didn't update earlier).
>
> I addressed Peter's comments, improved/simplified/documented the cocci
> script (which I split in smaller ones).
>
> Peter suggested other functions can be checked too, not only the
> "^object_property_set_.*" matches. Indeed, more patches added. Some
> are big.
>
> Another suggestion is replace in init() 'NULL' Error* final argument
> by &error_abort. This can be another series on top.
> However I noticed we can reduce the error_propagate() generated calls
> in many places, when both init()/realize() exist and the property set
> is not dependent of parent operation, by moving these calls from
> realize() to init(). Another cocci script. But to make sense it has to
> be run previous the "add missing error_propagate" one.
>
> While writing the cocci patches, I had 3 different Coccinelle failures.
> Failures not due to a spatch bug, but timeout because C source hard to
> process. Indeed the C source code was dubious, could get some
> simplification rewrite. Then spatch could transform them. More patches
> in the middle.
>
> Now I'm at 47 patches, the reviewed patches at the end of the series.
> Too much for RC2. Since I don't think these are critical bugs, but
> improvements, are you OK to postpone this series to 5.1?

Punting bug fixes to a later release is always kind of sad, but getting
that many patches reviewed properly in time for -rc2 feels hopeless, and
the bugs old and unthreatending on first glance.

> If you think a patch deserves to be in 5.0, point me at it and I can
> send it ASAP with comments addressed. Else I'll post my series as
> -for-5.1 soon.

I'm okay with punting the whole series to 5.1.

We have quite some Error work pending for 5.1.  Beware of conflicts.

In particular, I now plan to make object_property_set() & friends return
a useful value.  This should make your patches a bit smaller.



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH-for-5.0 00/12] hw: Add missing error-propagation code
  2020-03-30  9:21   ` Stefan Hajnoczi
@ 2020-04-06 17:47     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-06 17:47 UTC (permalink / raw)
  To: Stefan Hajnoczi, Philippe Mathieu-Daudé
  Cc: Paul Burton, Sagar Karandikar, Michael S. Tsirkin, Jason Wang,
	Mark Cave-Ayland, qemu-devel@nongnu.org Developers,
	Alistair Francis, Edgar E. Iglesias, Peter Maydell,
	Markus Armbruster, Aleksandar Markovic, Palmer Dabbelt,
	Aleksandar Rikalo, Richard Henderson, Eduardo Habkost,
	Alistair Francis, qemu-arm, David Gibson, qemu-riscv,
	Bastian Koppelmann, Andrew Baumann, Jean-Christophe Dubois,
	qemu-ppc@nongnu.org list:PowerPC, Paolo Bonzini, Aurelien Jarno

On 3/30/20 11:21 AM, Stefan Hajnoczi wrote:
> On Wed, Mar 25, 2020 at 08:20:49PM +0100, Philippe Mathieu-Daudé wrote:
>> On Wed, Mar 25, 2020 at 8:18 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>>>
>>> This series is inspired of Peter fix:
>>> "hw/arm/xlnx-zynqmp.c: fix some error-handling code"
>>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg691636.html
>>>
>>> Add a cocci script to fix the other places.
>>>
>>> Based-on: <20200324134947.15384-1-peter.maydell@linaro.org>
>>>
>>> Philippe Mathieu-Daud=C3=A9 (12):
>>
>> Hmm is that a git-publish bug?
> 
> Please run git-publish once more on the same branch and inspect the
> $TMPDIR/0000-cover-letter.patch email in an editor when git-publish
> prints "Stopping so you can inspect the patch emails:".
> 
> It would be interesting to see how your name is formatted, as well as
> the MIME Content-Type and Content-Transfer-Encoding headers.

Content-Type: text/plain; charset="utf-8"

Content-Transfer-Encoding: quoted-printable


Philippe Mathieu-Daud=C3=A9 (12):


> 
> This information can be compared to the final email sent to the list
> and/or received by the mailing list.
> 
> Stefan
> 



^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, back to index

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 19:18 [PATCH-for-5.0 00/12] hw: Add missing error-propagation code Philippe Mathieu-Daudé
2020-03-25 19:18 ` [PATCH-for-5.0 01/12] scripts/coccinelle: Add script to catch missing error_propagate() calls Philippe Mathieu-Daudé
2020-03-26 21:32   ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 02/12] hw/arm/bcm2835_peripherals: Add missing error-propagation code Philippe Mathieu-Daudé
2020-03-26 21:34   ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 03/12] hw/arm/fsl-imx: " Philippe Mathieu-Daudé
2020-03-26 21:35   ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 04/12] hw/arm/stm32fx05_soc: " Philippe Mathieu-Daudé
2020-03-25 20:51   ` Alistair Francis
2020-03-26 21:45   ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 05/12] hw/i386/x86: " Philippe Mathieu-Daudé
2020-03-26 21:38   ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: " Philippe Mathieu-Daudé
2020-03-25 20:52   ` Alistair Francis
2020-03-26 21:46   ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 07/12] hw/mips/cps: " Philippe Mathieu-Daudé
2020-03-26 21:43   ` Peter Maydell
2020-03-26 22:48   ` Aleksandar Markovic
2020-03-25 19:18 ` [PATCH-for-5.0 08/12] hw/mips/boston: " Philippe Mathieu-Daudé
2020-03-26 21:47   ` Peter Maydell
2020-03-26 22:50   ` Aleksandar Markovic
2020-03-25 19:18 ` [PATCH-for-5.0 09/12] hw/mips/mips_malta: " Philippe Mathieu-Daudé
2020-03-26 21:49   ` Peter Maydell
2020-03-26 22:49   ` Aleksandar Markovic
2020-03-25 19:18 ` [PATCH-for-5.0 10/12] hw/misc/macio/macio: " Philippe Mathieu-Daudé
2020-03-25 23:55   ` David Gibson
2020-03-26 21:50   ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: " Philippe Mathieu-Daudé
2020-03-25 20:52   ` Alistair Francis
2020-03-26 21:51   ` Peter Maydell
2020-03-25 19:18 ` [PATCH-for-5.0 12/12] hw/riscv/sifive_u: " Philippe Mathieu-Daudé
2020-03-25 20:52   ` Alistair Francis
2020-03-26 21:55   ` Peter Maydell
2020-03-31 17:02     ` Philippe Mathieu-Daudé
2020-03-31 17:03       ` Peter Maydell
2020-03-25 19:20 ` [PATCH-for-5.0 00/12] hw: " Philippe Mathieu-Daudé
2020-03-30  9:21   ` Stefan Hajnoczi
2020-04-06 17:47     ` Philippe Mathieu-Daudé
2020-03-31 13:23 ` Markus Armbruster
2020-04-03 17:53   ` Philippe Mathieu-Daudé
2020-04-04  5:55     ` Markus Armbruster

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git