cpu: Fix qemu_get_cpu() to return NULL if CPU not found

Commit 55e5c2850 breaks CPU not found return value, and returns
CPU corresponding to the last non NULL env.
Fix it by returning CPU only if env is not NULL, otherwise CPU is
not found and function should return NULL.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Igor Mammedov 2013-03-07 19:12:43 +01:00 committed by Andreas Färber
parent fe3cc14fd8
commit d76fddaeee

2
exec.c
View File

@ -260,7 +260,7 @@ CPUState *qemu_get_cpu(int index)
env = env->next_cpu; env = env->next_cpu;
} }
return cpu; return env ? cpu : NULL;
} }
void cpu_exec_init(CPUArchState *env) void cpu_exec_init(CPUArchState *env)