[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-9.0 17/25] backends: Reduce variable scope in host_memory_bac
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-9.0 17/25] backends: Reduce variable scope in host_memory_backend_memory_complete |
Date: |
Mon, 20 Nov 2023 22:32:51 +0100 |
Reduce the &local_err variable use and remove the 'out:' label.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
backends/hostmem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 3f8eb936d7..1b0043a0d9 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -324,7 +324,6 @@ host_memory_backend_memory_complete(UserCreatable *uc,
Error **errp)
{
HostMemoryBackend *backend = MEMORY_BACKEND(uc);
HostMemoryBackendClass *bc = MEMORY_BACKEND_GET_CLASS(uc);
- Error *local_err = NULL;
void *ptr;
uint64_t sz;
@@ -400,15 +399,16 @@ host_memory_backend_memory_complete(UserCreatable *uc,
Error **errp)
* specified NUMA policy in place.
*/
if (backend->prealloc) {
+ Error *local_err = NULL;
+
qemu_prealloc_mem(memory_region_get_fd(&backend->mr), ptr, sz,
backend->prealloc_threads,
backend->prealloc_context, &local_err);
if (local_err) {
- goto out;
+ error_propagate(errp, local_err);
+ return;
}
}
-out:
- error_propagate(errp, local_err);
}
static bool
--
2.41.0
- [PATCH-for-9.0 12/25] memory: Have memory_region_init_ram_from_file() handler return a boolean, (continued)
- [PATCH-for-9.0 12/25] memory: Have memory_region_init_ram_from_file() handler return a boolean, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 13/25] memory: Have memory_region_init_ram_from_fd() handler return a boolean, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 14/25] backends: Use g_autofree in HostMemoryBackendClass::alloc() handlers, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 15/25] backends: Simplify host_memory_backend_memory_complete(), Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 16/25] backends: Have HostMemoryBackendClass::alloc() handler return a boolean, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 17/25] backends: Reduce variable scope in host_memory_backend_memory_complete,
Philippe Mathieu-Daudé <=
- [PATCH-for-9.0 18/25] util/oslib: Have qemu_prealloc_mem() handler return a boolean, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 19/25] misc: Simplify qemu_prealloc_mem() calls, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 20/25] hw: Simplify memory_region_init_ram() calls, Philippe Mathieu-Daudé, 2023/11/20
- [PATCH-for-9.0 21/25] hw/arm: Simplify memory_region_init_rom() calls, Philippe Mathieu-Daudé, 2023/11/20