Skip to content

Commit 79a9909

Browse files
committed
exec/cpu: Have cpu_exec_realize() return a boolean
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>
1 parent 3a9d0d7 commit 79a9909

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cpu-target.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ const VMStateDescription vmstate_cpu_common = {
131131
};
132132
#endif
133133

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

139139
if (!accel_cpu_common_realize(cpu, errp)) {
140-
return;
140+
return false;
141141
}
142142

143143
/* Wait until cpu initialization complete before exposing cpu. */
@@ -159,6 +159,8 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
159159
vmstate_register(NULL, cpu->cpu_index, cpu->cc->sysemu_ops->legacy_vmsd, cpu);
160160
}
161161
#endif /* CONFIG_USER_ONLY */
162+
163+
return true;
162164
}
163165

164166
void cpu_exec_unrealizefn(CPUState *cpu)

include/hw/core/cpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...)
11521152
/* $(top_srcdir)/cpu.c */
11531153
void cpu_class_init_props(DeviceClass *dc);
11541154
void cpu_exec_initfn(CPUState *cpu);
1155-
void cpu_exec_realizefn(CPUState *cpu, Error **errp);
1155+
bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
11561156
void cpu_exec_unrealizefn(CPUState *cpu);
11571157
void cpu_exec_reset_hold(CPUState *cpu);
11581158

0 commit comments

Comments
 (0)