aboutsummaryrefslogtreecommitdiff
path: root/hw/riscv/sifive_e.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2020-02-22 18:12:57 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-03-17 15:18:49 +0100
commit414c47d234d6b12756d987bd93b9c8a04d009675 (patch)
treea93517813b9d5afe8fc4f4c59b98fd9b022dfb2c /hw/riscv/sifive_e.c
parenta8457764877c7d4070e5369e98d27876470ac6d0 (diff)
downloadqemu-414c47d234d6b12756d987bd93b9c8a04d009675.zip
qemu-414c47d234d6b12756d987bd93b9c8a04d009675.tar.gz
qemu-414c47d234d6b12756d987bd93b9c8a04d009675.tar.bz2
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 a1974ef..646553a 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);