Patch created mechanically by running: $ spatch \ --macro-file scripts/cocci-macro-file.h --include-headers \ --sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \ --keep-comments --smpl-spacing --in-place --dir hw
Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- hw/arm/fsl-imx25.c | 6 +++++- hw/arm/fsl-imx6.c | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 6f1a82ce3d..3d87fe867e 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -295,7 +295,11 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) }; object_property_set_bool(OBJECT(&s->usb[i]), true, "realized", - &error_abort); + &err); + if (err) { + error_propagate(errp, err); + return; + } 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), diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 6bf8aa0404..b3cef5bb57 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -359,7 +359,11 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) /* USB */ for (i = 0; i < FSL_IMX6_NUM_USB_PHYS; i++) { object_property_set_bool(OBJECT(&s->usbphy[i]), true, "realized", - &error_abort); + &err); + if (err) { + error_propagate(errp, err); + return; + } sysbus_mmio_map(SYS_BUS_DEVICE(&s->usbphy[i]), 0, FSL_IMX6_USBPHY1_ADDR + i * 0x1000); } @@ -372,7 +376,11 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) }; object_property_set_bool(OBJECT(&s->usb[i]), true, "realized", - &error_abort); + &err); + if (err) { + error_propagate(errp, err); + return; + } 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, @@ -430,7 +438,11 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) }; object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized", - &error_abort); + &err); + if (err) { + error_propagate(errp, err); + return; + } sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX6_WDOGn_ADDR[i]); } -- 2.21.1