summary refs log tree commit diff stats
path: root/backends/hostmem.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-11-20 13:50:52 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-01-05 16:20:15 +0100
commitfdb63cf3b57a230f4cc530ea2515229aeada0998 (patch)
tree431ecedada38c7c3b925b2b99430350ed9a36edf /backends/hostmem.c
parente199f7ad4df8b2c2efad0acdea91b936c130261c (diff)
downloadfocaccia-qemu-fdb63cf3b57a230f4cc530ea2515229aeada0998.tar.gz
focaccia-qemu-fdb63cf3b57a230f4cc530ea2515229aeada0998.zip
backends: Have HostMemoryBackendClass::alloc() handler return a boolean
Following the example documented since commit e3fe3988d7 ("error:
Document Error API usage rules"), have HostMemoryBackendClass::alloc
return a boolean indicating whether an error is set or not.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Message-Id: <20231120213301.24349-17-philmd@linaro.org>
Diffstat (limited to 'backends/hostmem.c')
-rw-r--r--backends/hostmem.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 1723c19165..3f8eb936d7 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -331,9 +331,8 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
     if (!bc->alloc) {
         return;
     }
-    bc->alloc(backend, &local_err);
-    if (local_err) {
-        goto out;
+    if (!bc->alloc(backend, errp)) {
+        return;
     }
 
     ptr = memory_region_get_ram_ptr(&backend->mr);