@@ -156,7 +156,11 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
MemoryRegion *sys_mem = get_system_memory();
object_property_set_bool(OBJECT(&s->cpus), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
/* MMIO */
s->plic = sifive_plic_create(memmap[SIFIVE_E_PLIC].base,
@@ -508,9 +508,17 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
NICInfo *nd = &nd_table[0];
object_property_set_bool(OBJECT(&s->e_cpus), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
object_property_set_bool(OBJECT(&s->u_cpus), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
/*
* 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
@@ -518,9 +526,17 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
* cluster is realized.
*/
object_property_set_bool(OBJECT(&s->e_cluster), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
object_property_set_bool(OBJECT(&s->u_cluster), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
/* create PLIC hart topology configuration string */
plic_hart_config_len = (strlen(SIFIVE_U_PLIC_HART_CONFIG) + 1) *
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 Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/riscv/sifive_e.c | 6 +++++- hw/riscv/sifive_u.c | 24 ++++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-)