summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorPaolo Bonzini2014-06-11 12:42:01 +0200
committerPaolo Bonzini2014-08-18 12:06:20 +0200
commitd8d95814609e89e5438a3318a647ec322fc4ff16 (patch)
treea3f5cd4ff75d6488f0b00968cd7ed5c3a8df2c0b /hw
parentioport: split deletion and destruction (diff)
downloadqemu-d8d95814609e89e5438a3318a647ec322fc4ff16.tar.gz
qemu-d8d95814609e89e5438a3318a647ec322fc4ff16.tar.xz
qemu-d8d95814609e89e5438a3318a647ec322fc4ff16.zip
memory: convert memory_region_destroy to object_unparent
Explicitly call object_unparent in the few places where we will re-create the memory region. If the memory region is simply being destroyed as part of device teardown, let QOM handle it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/display/vga.c2
-rw-r--r--hw/i386/kvmvapic.c2
-rw-r--r--hw/mips/gt64xxx_pci.c2
-rw-r--r--hw/misc/omap_gpmc.c2
-rw-r--r--hw/misc/vfio.c4
-rw-r--r--hw/ppc/ppc4xx_devs.c2
6 files changed, 7 insertions, 7 deletions
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 68cfee222a..65dab8dbed 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -176,7 +176,7 @@ static void vga_update_memory_access(VGACommonState *s)
if (s->has_chain4_alias) {
memory_region_del_subregion(s->legacy_address_space, &s->chain4_alias);
- memory_region_destroy(&s->chain4_alias);
+ object_unparent(OBJECT(&s->chain4_alias));
s->has_chain4_alias = false;
s->plane_updated = 0xf;
}
diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index cb855c7b79..ee959632a6 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -584,7 +584,7 @@ static int vapic_map_rom_writable(VAPICROMState *s)
if (s->rom_mapped_writable) {
memory_region_del_subregion(as, &s->rom);
- memory_region_destroy(&s->rom);
+ object_unparent(OBJECT(&s->rom));
}
/* grab RAM memory region (region @rom_paddr may still be pc.rom) */
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 22f63ce0c8..1f2fe5fab9 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -297,7 +297,7 @@ static void gt64120_pci_mapping(GT64120State *s)
if (s->PCI0IO_length)
{
memory_region_del_subregion(get_system_memory(), &s->PCI0IO_mem);
- memory_region_destroy(&s->PCI0IO_mem);
+ object_unparent(OBJECT(&s->PCI0IO_mem));
}
/* Map new IO address */
s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21;
diff --git a/hw/misc/omap_gpmc.c b/hw/misc/omap_gpmc.c
index cddea241d4..fbbe2ff993 100644
--- a/hw/misc/omap_gpmc.c
+++ b/hw/misc/omap_gpmc.c
@@ -436,7 +436,7 @@ static void omap_gpmc_cs_unmap(struct omap_gpmc_s *s, int cs)
}
memory_region_del_subregion(get_system_memory(), &f->container);
memory_region_del_subregion(&f->container, omap_gpmc_cs_memregion(s, cs));
- memory_region_destroy(&f->container);
+ object_unparent(OBJECT(&f->container));
}
void omap_gpmc_reset(struct omap_gpmc_s *s)
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index 0b9eba0c84..af9ae1fedf 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -2266,7 +2266,7 @@ static void vfio_vga_quirk_teardown(VFIODevice *vdev)
while (!QLIST_EMPTY(&vdev->vga.region[i].quirks)) {
VFIOQuirk *quirk = QLIST_FIRST(&vdev->vga.region[i].quirks);
memory_region_del_subregion(&vdev->vga.region[i].mem, &quirk->mem);
- memory_region_destroy(&quirk->mem);
+ object_unparent(OBJECT(&quirk->mem));
QLIST_REMOVE(quirk, next);
g_free(quirk);
}
@@ -2290,7 +2290,7 @@ static void vfio_bar_quirk_teardown(VFIODevice *vdev, int nr)
while (!QLIST_EMPTY(&bar->quirks)) {
VFIOQuirk *quirk = QLIST_FIRST(&bar->quirks);
memory_region_del_subregion(&bar->mem, &quirk->mem);
- memory_region_destroy(&quirk->mem);
+ object_unparent(OBJECT(&quirk->mem));
QLIST_REMOVE(quirk, next);
g_free(quirk);
}
diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c
index 07f9d00ea7..405bbe718b 100644
--- a/hw/ppc/ppc4xx_devs.c
+++ b/hw/ppc/ppc4xx_devs.c
@@ -422,7 +422,7 @@ static void sdram_set_bcr(ppc4xx_sdram_t *sdram,
&sdram->containers[n]);
memory_region_del_subregion(&sdram->containers[n],
&sdram->ram_memories[n]);
- memory_region_destroy(&sdram->containers[n]);
+ object_unparent(OBJECT(&sdram->containers[n]));
}
*bcrp = bcr & 0xFFDEE001;
if (enabled && (bcr & 0x00000001)) {