[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/7] hw/char: Let devices own the MemoryRegion they create
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 3/7] hw/char: Let devices own the MemoryRegion they create |
Date: |
Fri, 21 Feb 2020 18:30:45 +0100 |
To avoid orphean memory regions being added in the /unattached
QOM container, use the memory_region_owner_nonnull.cocci script
to set the correct ownership.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/char/serial.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 9298881af9..2ab8b69e03 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -997,7 +997,7 @@ static void serial_io_realize(DeviceState *dev, Error
**errp)
return;
}
- memory_region_init_io(&s->io, NULL, &serial_io_ops, s, "serial", 8);
+ memory_region_init_io(&s->io, OBJECT(dev), &serial_io_ops, s, "serial", 8);
sysbus_init_mmio(SYS_BUS_DEVICE(sio), &s->io);
sysbus_init_irq(SYS_BUS_DEVICE(sio), &s->irq);
}
@@ -1106,8 +1106,9 @@ static void serial_mm_realize(DeviceState *dev, Error
**errp)
return;
}
- memory_region_init_io(&s->io, NULL, &serial_mm_ops[smm->endianness], smm,
- "serial", 8 << smm->regshift);
+ memory_region_init_io(&s->io, OBJECT(dev),
+ &serial_mm_ops[smm->endianness], smm, "serial",
+ 8 << smm->regshift);
sysbus_init_mmio(SYS_BUS_DEVICE(smm), &s->io);
sysbus_init_irq(SYS_BUS_DEVICE(smm), &smm->serial.irq);
}
--
2.21.1
- [PATCH 0/7] hw: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 1/7] scripts/coccinelle: Add a script to let devices own their MemoryRegions, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 3/7] hw/char: Let devices own the MemoryRegion they create,
Philippe Mathieu-Daudé <=
- [PATCH 2/7] hw/arm: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 4/7] hw/core: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 5/7] hw/display: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 7/7] hw/riscv: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 6/7] hw/dma: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21