Coccinelle reported: $ spatch ... --timeout 60 --sp-file \ scripts/coccinelle/simplify-init-realize-error_propagate.cocci HANDLING: hw/arm/fsl-imx31.c >>> possible moves from fsl_imx31_init() to fsl_imx31_realize() in hw/arm/fsl-imx31.c:68
Move the calls using &error_abort which don't depend on input updated before realize() to init(). Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- v3: Typo 'depend of' -> 'depend on' (eblake) --- hw/arm/fsl-imx31.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 8472d2e911..61287e24f6 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -62,6 +62,8 @@ static void fsl_imx31_init(Object *obj) for (i = 0; i < FSL_IMX31_NUM_GPIOS; i++) { sysbus_init_child_obj(obj, "gpio[*]", &s->gpio[i], sizeof(s->gpio[i]), TYPE_IMX_GPIO); + object_property_set_bool(OBJECT(&s->gpio[i]), false, "has-edge-sel", + &error_abort); } } @@ -191,8 +193,6 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp) { FSL_IMX31_GPIO3_ADDR, FSL_IMX31_GPIO3_IRQ } }; - object_property_set_bool(OBJECT(&s->gpio[i]), false, "has-edge-sel", - &error_abort); object_property_set_bool(OBJECT(&s->gpio[i]), true, "realized", &err); if (err) { error_propagate(errp, err); -- 2.21.1