]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/display: Let devices own the MemoryRegion they create
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Sat, 22 Feb 2020 17:12:09 +0000 (18:12 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 17 Mar 2020 14:18:48 +0000 (15:18 +0100)
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>
hw/display/g364fb.c
hw/display/macfb.c

index 55185c95c610948e842f546ae52f491de49e3790..adcba96e34f87594d56f1a4b1e8cc2f31164d017 100644 (file)
@@ -477,7 +477,8 @@ static void g364fb_init(DeviceState *dev, G364State *s)
 
     s->con = graphic_console_init(dev, 0, &g364fb_ops, s);
 
-    memory_region_init_io(&s->mem_ctrl, NULL, &g364fb_ctrl_ops, s, "ctrl", 0x180000);
+    memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &g364fb_ctrl_ops, s,
+                          "ctrl", 0x180000);
     memory_region_init_ram_ptr(&s->mem_vram, NULL, "vram",
                                s->vram_size, s->vram);
     vmstate_register_ram(&s->mem_vram, dev);
index 8bff16d535f621734bcb2510ac558cd66759ebe3..b68faff4bb0cdf1e28dcfeb41e78372352be7670 100644 (file)
@@ -362,8 +362,8 @@ static void macfb_common_realize(DeviceState *dev, MacfbState *s, Error **errp)
         return;
     }
 
-    memory_region_init_io(&s->mem_ctrl, NULL, &macfb_ctrl_ops, s, "macfb-ctrl",
-                          0x1000);
+    memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &macfb_ctrl_ops, s,
+                          "macfb-ctrl", 0x1000);
 
     memory_region_init_ram_nomigrate(&s->mem_vram, OBJECT(s), "macfb-vram",
                                      MACFB_VRAM_SIZE, errp);