[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-9.0 03/25] memory: Have memory_region_init_rom_nomigrate() ha
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-9.0 03/25] memory: Have memory_region_init_rom_nomigrate() handler return a boolean |
Date: |
Mon, 20 Nov 2023 22:32:37 +0100 |
Following the example documented since commit e3fe3988d7 ("error:
Document Error API usage rules"), have cpu_exec_realizefn()
return a boolean indicating whether an error is set or not.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/exec/memory.h | 4 +++-
system/memory.c | 8 ++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 4140eb0c95..8e6fb55f59 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1498,8 +1498,10 @@ void memory_region_init_alias(MemoryRegion *mr,
* must be unique within any device
* @size: size of the region.
* @errp: pointer to Error*, to store an error if it happens.
+ *
+ * Return: true on success, else false setting @errp with error.
*/
-void memory_region_init_rom_nomigrate(MemoryRegion *mr,
+bool memory_region_init_rom_nomigrate(MemoryRegion *mr,
Object *owner,
const char *name,
uint64_t size,
diff --git a/system/memory.c b/system/memory.c
index 337b12a674..bfe0b62d59 100644
--- a/system/memory.c
+++ b/system/memory.c
@@ -1729,14 +1729,18 @@ 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);
+ bool rv;
+
+ rv = memory_region_init_ram_flags_nomigrate(mr, owner, name, size, 0,
errp);
mr->readonly = true;
+
+ return rv;
}
void memory_region_init_rom_device_nomigrate(MemoryRegion *mr,
--
2.41.0
- [PATCH-for-9.0 00/25] memory: Propagate Error* when possible, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 01/25] memory: Have memory_region_init_ram_flags_nomigrate() return a boolean, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 02/25] memory: Have memory_region_init_ram_nomigrate() handler return a boolean, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 03/25] memory: Have memory_region_init_rom_nomigrate() handler return a boolean,
Philippe Mathieu-Daudé <=
- [PATCH-for-9.0 04/25] memory: Simplify memory_region_init_rom_nomigrate() calls, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 05/25] memory: Simplify memory_region_init_ram_from_fd() calls, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 06/25] memory: Have memory_region_init_ram() handler return a boolean, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 07/25] memory: Have memory_region_init_rom() handler return a boolean, Philippe Mathieu-Daudé, 2023/11/20