aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-11-20 11:27:11 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-01-05 16:20:15 +0100
commit197faa7006313407ade82de8bc49d52da610da46 (patch)
tree64c0ae5e82404f693fa1a2283d9700beee20f69b /system
parent62c19b72c7fefb5fcd13ed4e2c833d2f99458193 (diff)
downloadqemu-197faa7006313407ade82de8bc49d52da610da46.zip
qemu-197faa7006313407ade82de8bc49d52da610da46.tar.gz
qemu-197faa7006313407ade82de8bc49d52da610da46.tar.bz2
memory: Have memory_region_init_rom_nomigrate() handler return a boolean
Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_rom_nomigrate return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Message-Id: <20231120213301.24349-4-philmd@linaro.org> [PMD: Only update 'readonly' field on success (Manos Pitsidianakis)] Message-Id: <af352e7d-3346-4705-be77-6eed86858d18@linaro.org>
Diffstat (limited to 'system')
-rw-r--r--system/memory.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/system/memory.c b/system/memory.c
index f9e5ae2..72c6441 100644
--- a/system/memory.c
+++ b/system/memory.c
@@ -1701,14 +1701,19 @@ void memory_region_init_alias(MemoryRegion *mr,
mr->alias_offset = offset;
}
-void memory_region_init_rom_nomigrate(MemoryRegion *mr,
+bool memory_region_init_rom_nomigrate(MemoryRegion *mr,
Object *owner,
const char *name,
uint64_t size,
Error **errp)
{
- memory_region_init_ram_flags_nomigrate(mr, owner, name, size, 0, errp);
+ if (!memory_region_init_ram_flags_nomigrate(mr, owner, name,
+ size, 0, errp)) {
+ return false;
+ }
mr->readonly = true;
+
+ return true;
}
void memory_region_init_rom_device_nomigrate(MemoryRegion *mr,