diff options
author | Thomas Huth <thuth@redhat.com> | 2022-03-17 09:30:25 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2022-03-18 10:15:57 +0100 |
commit | 6832deb8ff0807e0b46a8a67f5d2abfa36ca3b47 (patch) | |
tree | 449b34641837d3930a2f6dcf645cda3696a4d432 /hw/display/vga.c | |
parent | 5f2011be44b8d17f93680d01d617cd9a96678886 (diff) |
hw/display: Allow vga_common_init() to return errors
The vga_common_init() function currently cannot report errors to its
caller. But in the following patch, we'd need this possibility, so
let's change it to take an "Error **" as parameter for this.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220317083027.16688-3-thuth@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/display/vga.c')
-rw-r--r-- | hw/display/vga.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/hw/display/vga.c b/hw/display/vga.c index 9d1f66af40..ae96023596 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -2168,9 +2168,10 @@ static inline uint32_t uint_clamp(uint32_t val, uint32_t vmin, uint32_t vmax) return val; } -void vga_common_init(VGACommonState *s, Object *obj) +bool vga_common_init(VGACommonState *s, Object *obj, Error **errp) { int i, j, v, b; + Error *local_err = NULL; for(i = 0;i < 256; i++) { v = 0; @@ -2206,7 +2207,11 @@ void vga_common_init(VGACommonState *s, Object *obj) s->is_vbe_vmstate = 1; memory_region_init_ram_nomigrate(&s->vram, obj, "vga.vram", s->vram_size, - &error_fatal); + &local_err); + if (local_err) { + error_propagate(errp, local_err); + return false; + } vmstate_register_ram(&s->vram, s->global_vmstate ? NULL : DEVICE(obj)); xen_register_framebuffer(&s->vram); s->vram_ptr = memory_region_get_ram_ptr(&s->vram); @@ -2237,6 +2242,8 @@ void vga_common_init(VGACommonState *s, Object *obj) s->default_endian_fb = false; #endif vga_dirty_log_start(s); + + return true; } static const MemoryRegionPortio vga_portio_list[] = { |