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>
This commit is contained in:
parent
62c19b72c7
commit
197faa7006
@ -1498,8 +1498,10 @@ void memory_region_init_alias(MemoryRegion *mr,
|
|||||||
* must be unique within any device
|
* must be unique within any device
|
||||||
* @size: size of the region.
|
* @size: size of the region.
|
||||||
* @errp: pointer to Error*, to store an error if it happens.
|
* @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,
|
Object *owner,
|
||||||
const char *name,
|
const char *name,
|
||||||
uint64_t size,
|
uint64_t size,
|
||||||
|
@ -1701,14 +1701,19 @@ void memory_region_init_alias(MemoryRegion *mr,
|
|||||||
mr->alias_offset = offset;
|
mr->alias_offset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void memory_region_init_rom_nomigrate(MemoryRegion *mr,
|
bool memory_region_init_rom_nomigrate(MemoryRegion *mr,
|
||||||
Object *owner,
|
Object *owner,
|
||||||
const char *name,
|
const char *name,
|
||||||
uint64_t size,
|
uint64_t size,
|
||||||
Error **errp)
|
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;
|
mr->readonly = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void memory_region_init_rom_device_nomigrate(MemoryRegion *mr,
|
void memory_region_init_rom_device_nomigrate(MemoryRegion *mr,
|
||||||
|
Loading…
Reference in New Issue
Block a user