summaryrefslogtreecommitdiffstats
path: root/hw/riscv/sifive_e.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé2020-02-22 18:12:57 +0100
committerPaolo Bonzini2020-03-17 15:18:49 +0100
commit414c47d234d6b12756d987bd93b9c8a04d009675 (patch)
treea93517813b9d5afe8fc4f4c59b98fd9b022dfb2c /hw/riscv/sifive_e.c
parenthw/dma: Let devices own the MemoryRegion they create (diff)
downloadqemu-414c47d234d6b12756d987bd93b9c8a04d009675.tar.gz
qemu-414c47d234d6b12756d987bd93b9c8a04d009675.tar.xz
qemu-414c47d234d6b12756d987bd93b9c8a04d009675.zip
hw/riscv: Let devices own the MemoryRegion they create
Avoid orphan memory regions being added in the /unattached QOM container. This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'hw/riscv/sifive_e.c')
-rw-r--r--hw/riscv/sifive_e.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index a1974ef7be..646553a7c3 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -145,8 +145,8 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
&error_abort);
/* Mask ROM */
- memory_region_init_rom(&s->mask_rom, NULL, "riscv.sifive.e.mrom",
- memmap[SIFIVE_E_MROM].size, &error_fatal);
+ memory_region_init_rom(&s->mask_rom, OBJECT(dev), "riscv.sifive.e.mrom",
+ memmap[SIFIVE_E_MROM].size, &error_fatal);
memory_region_add_subregion(sys_mem,
memmap[SIFIVE_E_MROM].base, &s->mask_rom);
@@ -208,7 +208,7 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
memmap[SIFIVE_E_PWM2].base, memmap[SIFIVE_E_PWM2].size);
/* Flash memory */
- memory_region_init_rom(&s->xip_mem, NULL, "riscv.sifive.e.xip",
+ memory_region_init_rom(&s->xip_mem, OBJECT(dev), "riscv.sifive.e.xip",
memmap[SIFIVE_E_XIP].size, &error_fatal);
memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_XIP].base,
&s->xip_mem);