Skip to content

Commit

Permalink
exec/cpu: Have cpu_exec_realize() return a boolean
Browse files Browse the repository at this point in the history
Following the example documented since commit e3fe398 ("error:
Document Error API usage rules"), have cpu_exec_realizefn()
return a boolean indicating whether an error is set or not.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230918160257.30127-22-philmd@linaro.org>
  • Loading branch information
philmd committed Nov 7, 2023
1 parent 3a9d0d7 commit 79a9909
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions cpu-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ const VMStateDescription vmstate_cpu_common = {
};
#endif

void cpu_exec_realizefn(CPUState *cpu, Error **errp)
bool cpu_exec_realizefn(CPUState *cpu, Error **errp)
{
/* cache the cpu class for the hotpath */
cpu->cc = CPU_GET_CLASS(cpu);

if (!accel_cpu_common_realize(cpu, errp)) {
return;
return false;
}

/* Wait until cpu initialization complete before exposing cpu. */
Expand All @@ -159,6 +159,8 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
vmstate_register(NULL, cpu->cpu_index, cpu->cc->sysemu_ops->legacy_vmsd, cpu);
}
#endif /* CONFIG_USER_ONLY */

return true;
}

void cpu_exec_unrealizefn(CPUState *cpu)
Expand Down
2 changes: 1 addition & 1 deletion include/hw/core/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...)
/* $(top_srcdir)/cpu.c */
void cpu_class_init_props(DeviceClass *dc);
void cpu_exec_initfn(CPUState *cpu);
void cpu_exec_realizefn(CPUState *cpu, Error **errp);
bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
void cpu_exec_unrealizefn(CPUState *cpu);
void cpu_exec_reset_hold(CPUState *cpu);

Expand Down

0 comments on commit 79a9909

Please sign in to comment.