mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 05:28:36 -07:00
monitor: fix maybe-uninitialized
../monitor/misc.c: In function ‘mon_get_cpu_sync’:
/home/elmarco/src/qq/include/sysemu/hw_accel.h:22:9: error: ‘cpu’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
22 | kvm_cpu_synchronize_state(cpu);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../monitor/misc.c:397:15: note: ‘cpu’ was declared here
397 | CPUState *cpu;
| ^~~
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e4f1bea2a8
commit
a85d0bf361
1 changed files with 2 additions and 1 deletions
|
|
@ -394,7 +394,7 @@ int monitor_set_cpu(int cpu_index)
|
||||||
/* Callers must hold BQL. */
|
/* Callers must hold BQL. */
|
||||||
static CPUState *mon_get_cpu_sync(bool synchronize)
|
static CPUState *mon_get_cpu_sync(bool synchronize)
|
||||||
{
|
{
|
||||||
CPUState *cpu;
|
CPUState *cpu = NULL;
|
||||||
|
|
||||||
if (cur_mon->mon_cpu_path) {
|
if (cur_mon->mon_cpu_path) {
|
||||||
cpu = (CPUState *) object_resolve_path_type(cur_mon->mon_cpu_path,
|
cpu = (CPUState *) object_resolve_path_type(cur_mon->mon_cpu_path,
|
||||||
|
|
@ -411,6 +411,7 @@ static CPUState *mon_get_cpu_sync(bool synchronize)
|
||||||
monitor_set_cpu(first_cpu->cpu_index);
|
monitor_set_cpu(first_cpu->cpu_index);
|
||||||
cpu = first_cpu;
|
cpu = first_cpu;
|
||||||
}
|
}
|
||||||
|
assert(cpu != NULL);
|
||||||
if (synchronize) {
|
if (synchronize) {
|
||||||
cpu_synchronize_state(cpu);
|
cpu_synchronize_state(cpu);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue