mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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>
This commit is contained in:
parent
5b871c1b62
commit
32b9523ad5
10 changed files with 40 additions and 39 deletions
|
@ -95,14 +95,15 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp)
|
|||
Error *err = NULL;
|
||||
int i;
|
||||
|
||||
memory_region_init_rom(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE,
|
||||
&err);
|
||||
memory_region_init_rom(&s->flash, OBJECT(dev_soc), "STM32F405.flash",
|
||||
FLASH_SIZE, &err);
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
}
|
||||
memory_region_init_alias(&s->flash_alias, NULL, "STM32F405.flash.alias",
|
||||
&s->flash, 0, FLASH_SIZE);
|
||||
memory_region_init_alias(&s->flash_alias, OBJECT(dev_soc),
|
||||
"STM32F405.flash.alias", &s->flash, 0,
|
||||
FLASH_SIZE);
|
||||
|
||||
memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->flash);
|
||||
memory_region_add_subregion(system_memory, 0, &s->flash_alias);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue