Skip to content

Commit

Permalink
spike: Fix crash when introspecting the device
Browse files Browse the repository at this point in the history
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael Clark <mjc@sifive.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
alistair23 committed Jul 19, 2018
1 parent 5657c3f commit 8ff62f6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions hw/riscv/spike.c
Expand Up @@ -171,9 +171,8 @@ static void spike_v1_10_0_board_init(MachineState *machine)
int i;

/* Initialize SOC */
object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
&error_abort);
object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
object_property_set_str(OBJECT(&s->soc), SPIKE_V1_10_0_CPU, "cpu-type",
&error_abort);
object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
Expand Down Expand Up @@ -254,9 +253,8 @@ static void spike_v1_09_1_board_init(MachineState *machine)
int i;

/* Initialize SOC */
object_initialize(&s->soc, sizeof(s->soc), TYPE_RISCV_HART_ARRAY);
object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
&error_abort);
object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
object_property_set_str(OBJECT(&s->soc), SPIKE_V1_09_1_CPU, "cpu-type",
&error_abort);
object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
Expand Down

0 comments on commit 8ff62f6

Please sign in to comment.