mirror of https://gitee.com/openkylin/qemu.git
tcg: Remove error return from tcg_region_initial_alloc__locked
All callers immediately assert on error, so move the assert into the function itself. Reviewed-by: Luis Pires <luis.pires@eldorado.org.br> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
b0a0794a0f
commit
bd35f2ceac
19
tcg/tcg.c
19
tcg/tcg.c
|
@ -720,9 +720,10 @@ static bool tcg_region_alloc(TCGContext *s)
|
||||||
* Perform a context's first region allocation.
|
* Perform a context's first region allocation.
|
||||||
* This function does _not_ increment region.agg_size_full.
|
* 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 */
|
/* Call from a safe-work context */
|
||||||
|
@ -737,9 +738,7 @@ void tcg_region_reset_all(void)
|
||||||
|
|
||||||
for (i = 0; i < n_ctxs; i++) {
|
for (i = 0; i < n_ctxs; i++) {
|
||||||
TCGContext *s = qatomic_read(&tcg_ctxs[i]);
|
TCGContext *s = qatomic_read(&tcg_ctxs[i]);
|
||||||
bool err = tcg_region_initial_alloc__locked(s);
|
tcg_region_initial_alloc__locked(s);
|
||||||
|
|
||||||
g_assert(!err);
|
|
||||||
}
|
}
|
||||||
qemu_mutex_unlock(®ion.lock);
|
qemu_mutex_unlock(®ion.lock);
|
||||||
|
|
||||||
|
@ -876,11 +875,7 @@ void tcg_region_init(void)
|
||||||
|
|
||||||
/* In user-mode we support only one ctx, so do the initial allocation now */
|
/* In user-mode we support only one ctx, so do the initial allocation now */
|
||||||
#ifdef CONFIG_USER_ONLY
|
#ifdef CONFIG_USER_ONLY
|
||||||
{
|
tcg_region_initial_alloc__locked(tcg_ctx);
|
||||||
bool err = tcg_region_initial_alloc__locked(tcg_ctx);
|
|
||||||
|
|
||||||
g_assert(!err);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -942,7 +937,6 @@ void tcg_register_thread(void)
|
||||||
MachineState *ms = MACHINE(qdev_get_machine());
|
MachineState *ms = MACHINE(qdev_get_machine());
|
||||||
TCGContext *s = g_malloc(sizeof(*s));
|
TCGContext *s = g_malloc(sizeof(*s));
|
||||||
unsigned int i, n;
|
unsigned int i, n;
|
||||||
bool err;
|
|
||||||
|
|
||||||
*s = tcg_init_ctx;
|
*s = tcg_init_ctx;
|
||||||
|
|
||||||
|
@ -966,8 +960,7 @@ void tcg_register_thread(void)
|
||||||
|
|
||||||
tcg_ctx = s;
|
tcg_ctx = s;
|
||||||
qemu_mutex_lock(®ion.lock);
|
qemu_mutex_lock(®ion.lock);
|
||||||
err = tcg_region_initial_alloc__locked(tcg_ctx);
|
tcg_region_initial_alloc__locked(s);
|
||||||
g_assert(!err);
|
|
||||||
qemu_mutex_unlock(®ion.lock);
|
qemu_mutex_unlock(®ion.lock);
|
||||||
}
|
}
|
||||||
#endif /* !CONFIG_USER_ONLY */
|
#endif /* !CONFIG_USER_ONLY */
|
||||||
|
|
Loading…
Reference in New Issue