Use memory_region_new_ram to avoid leaking memory region. This would
be a migration break but the machines using this don't seem to support
migration and even if they did we make no compatibility guarantee for
these machines.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/xtensa/xtfpga.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index b025cc53a8..b8ae1994d8 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -50,7 +50,6 @@
#include "xtensa_memory.h"
#include "hw/xtensa/mx_pic.h"
#include "exec/cpu-common.h"
-#include "migration/vmstate.h"
typedef struct XtfpgaFlashDesc {
hwaddr base;
@@ -162,10 +161,8 @@ static void xtfpga_net_init(MemoryRegion *address_space,
memory_region_add_subregion(address_space, descriptors,
sysbus_mmio_get_region(s, 1));
- ram = g_malloc(sizeof(*ram));
- memory_region_init_ram_flags_nomigrate(ram, OBJECT(s), "open_eth.ram",
- 16 * KiB, 0, &error_fatal);
- vmstate_register_ram_global(ram);
+ ram = memory_region_new_ram(OBJECT(s), "open_eth.ram", 16 * KiB,
+ &error_fatal);
memory_region_add_subregion(address_space, buffers, ram);
}
--
2.41.3