[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 04/28] tcg: Remove error return from tcg_region_initial_alloc_
From: |
Richard Henderson |
Subject: |
[PATCH v3 04/28] tcg: Remove error return from tcg_region_initial_alloc__locked |
Date: |
Sun, 2 May 2021 16:18:20 -0700 |
All callers immediately assert on error, so move the assert
into the function itself.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/tcg.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 795a71ff25..8b57e93ca2 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -723,9 +723,10 @@ static bool tcg_region_alloc(TCGContext *s)
* Perform a context's first region allocation.
* This function does _not_ increment region.agg_size_full.
*/
-static inline bool tcg_region_initial_alloc__locked(TCGContext *s)
+static void tcg_region_initial_alloc__locked(TCGContext *s)
{
- return tcg_region_alloc__locked(s);
+ bool err = tcg_region_alloc__locked(s);
+ g_assert(!err);
}
/* Call from a safe-work context */
@@ -740,9 +741,7 @@ void tcg_region_reset_all(void)
for (i = 0; i < n_ctxs; i++) {
TCGContext *s = qatomic_read(&tcg_ctxs[i]);
- bool err = tcg_region_initial_alloc__locked(s);
-
- g_assert(!err);
+ tcg_region_initial_alloc__locked(s);
}
qemu_mutex_unlock(®ion.lock);
@@ -879,11 +878,7 @@ void tcg_region_init(void)
/* In user-mode we support only one ctx, so do the initial allocation now
*/
#ifdef CONFIG_USER_ONLY
- {
- bool err = tcg_region_initial_alloc__locked(tcg_ctx);
-
- g_assert(!err);
- }
+ tcg_region_initial_alloc__locked(tcg_ctx);
#endif
}
@@ -945,7 +940,6 @@ void tcg_register_thread(void)
MachineState *ms = MACHINE(qdev_get_machine());
TCGContext *s = g_malloc(sizeof(*s));
unsigned int i, n;
- bool err;
*s = tcg_init_ctx;
@@ -969,8 +963,7 @@ void tcg_register_thread(void)
tcg_ctx = s;
qemu_mutex_lock(®ion.lock);
- err = tcg_region_initial_alloc__locked(tcg_ctx);
- g_assert(!err);
+ tcg_region_initial_alloc__locked(s);
qemu_mutex_unlock(®ion.lock);
}
#endif /* !CONFIG_USER_ONLY */
--
2.25.1
- [PATCH v3 00/28] tcg: Clean up code_gen_buffer allocation, Richard Henderson, 2021/05/02
- [PATCH v3 01/28] meson: Split out tcg/meson.build, Richard Henderson, 2021/05/02
- [PATCH v3 03/28] tcg: Re-order tcg_region_init vs tcg_prologue_init, Richard Henderson, 2021/05/02
- [PATCH v3 06/28] tcg: Split out tcg_region_prologue_set, Richard Henderson, 2021/05/02
- [PATCH v3 05/28] tcg: Split out tcg_region_initial_alloc, Richard Henderson, 2021/05/02
- [PATCH v3 02/28] meson: Split out fpu/meson.build, Richard Henderson, 2021/05/02
- [PATCH v3 04/28] tcg: Remove error return from tcg_region_initial_alloc__locked,
Richard Henderson <=
- [PATCH v3 08/28] accel/tcg: Inline cpu_gen_init, Richard Henderson, 2021/05/02
- [PATCH v3 10/28] accel/tcg: Rename tcg_init to tcg_init_machine, Richard Henderson, 2021/05/02
- [PATCH v3 07/28] tcg: Split out region.c, Richard Henderson, 2021/05/02
- [PATCH v3 15/28] tcg: Move MAX_CODE_GEN_BUFFER_SIZE to tcg-target.h, Richard Henderson, 2021/05/02
- [PATCH v3 11/28] tcg: Create tcg_init, Richard Henderson, 2021/05/02
- [PATCH v3 18/28] tcg: Tidy tcg_n_regions, Richard Henderson, 2021/05/02
- [PATCH v3 16/28] tcg: Replace region.end with region.total_size, Richard Henderson, 2021/05/02
- [PATCH v3 24/28] util/osdep: Add qemu_mprotect_rw, Richard Henderson, 2021/05/02
- [PATCH v3 17/28] tcg: Rename region.start to region.after_prologue, Richard Henderson, 2021/05/02
- [PATCH v3 22/28] tcg: Return the map protection from alloc_code_gen_buffer, Richard Henderson, 2021/05/02