aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorHu Tao <hutao@cn.fujitsu.com>2014-09-09 13:27:54 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2014-09-09 13:41:25 +0200
commitef701d7b6f9e33cef11c823b140a0f93e150b27b (patch)
treed06f422bf8f59c7947fd0d6e7a1ddeed21312110 /memory.c
parentc261d774fb9093d00e0938a19f502fb220f62718 (diff)
downloadqemu-ef701d7b6f9e33cef11c823b140a0f93e150b27b.zip
qemu-ef701d7b6f9e33cef11c823b140a0f93e150b27b.tar.gz
qemu-ef701d7b6f9e33cef11c823b140a0f93e150b27b.tar.bz2
exec: add parameter errp to qemu_ram_alloc and qemu_ram_alloc_from_ptr
Add parameter errp to qemu_ram_alloc and qemu_ram_alloc_from_ptr so that we can handle errors. Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> [Assert ptr != NULL in memory_region_init_ram_ptr. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/memory.c b/memory.c
index 1bae951..930fa5d 100644
--- a/memory.c
+++ b/memory.c
@@ -1148,7 +1148,7 @@ void memory_region_init_ram(MemoryRegion *mr,
mr->ram = true;
mr->terminates = true;
mr->destructor = memory_region_destructor_ram;
- mr->ram_addr = qemu_ram_alloc(size, mr);
+ mr->ram_addr = qemu_ram_alloc(size, mr, &error_abort);
}
#ifdef __linux__
@@ -1178,7 +1178,10 @@ void memory_region_init_ram_ptr(MemoryRegion *mr,
mr->ram = true;
mr->terminates = true;
mr->destructor = memory_region_destructor_ram_from_ptr;
- mr->ram_addr = qemu_ram_alloc_from_ptr(size, ptr, mr);
+
+ /* qemu_ram_alloc_from_ptr cannot fail with ptr != NULL. */
+ assert(ptr != NULL);
+ mr->ram_addr = qemu_ram_alloc_from_ptr(size, ptr, mr, &error_abort);
}
void memory_region_init_alias(MemoryRegion *mr,
@@ -1208,7 +1211,7 @@ void memory_region_init_rom_device(MemoryRegion *mr,
mr->terminates = true;
mr->rom_device = true;
mr->destructor = memory_region_destructor_rom_device;
- mr->ram_addr = qemu_ram_alloc(size, mr);
+ mr->ram_addr = qemu_ram_alloc(size, mr, &error_abort);
}
void memory_region_init_iommu(MemoryRegion *mr,