diff options
| author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2020-02-24 18:32:23 +0100 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-03-17 15:18:50 +0100 |
| commit | 32b9523ad5b44dea87792d5d8f71a87e8cc5803b (patch) | |
| tree | cbb0e660e9f536833bc7c7c24d6b37d51477bcab /hw/arm/stm32f205_soc.c | |
| parent | 5b871c1b62036ef06eaf96ec03bbad801fcf9b89 (diff) | |
| download | focaccia-qemu-32b9523ad5b44dea87792d5d8f71a87e8cc5803b.tar.gz focaccia-qemu-32b9523ad5b44dea87792d5d8f71a87e8cc5803b.zip | |
hw/arm: 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/arm/stm32f205_soc.c')
| -rw-r--r-- | hw/arm/stm32f205_soc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 6e93726d45..118c342559 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -93,10 +93,10 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) MemoryRegion *flash = g_new(MemoryRegion, 1); MemoryRegion *flash_alias = g_new(MemoryRegion, 1); - memory_region_init_rom(flash, NULL, "STM32F205.flash", FLASH_SIZE, - &error_fatal); - memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias", - flash, 0, FLASH_SIZE); + memory_region_init_rom(flash, OBJECT(dev_soc), "STM32F205.flash", + FLASH_SIZE, &error_fatal); + memory_region_init_alias(flash_alias, OBJECT(dev_soc), + "STM32F205.flash.alias", flash, 0, FLASH_SIZE); memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); memory_region_add_subregion(system_memory, 0, flash_alias); |