diff options
author | Hu Tao <hutao@cn.fujitsu.com> | 2014-09-09 13:27:54 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-09-09 13:41:25 +0200 |
commit | ef701d7b6f9e33cef11c823b140a0f93e150b27b (patch) | |
tree | d06f422bf8f59c7947fd0d6e7a1ddeed21312110 /memory.c | |
parent | c261d774fb9093d00e0938a19f502fb220f62718 (diff) |
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.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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, |