From d76fddaeeec674cab4802b585db6c9fb3a0066dc Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 7 Mar 2013 19:12:43 +0100 Subject: cpu: Fix qemu_get_cpu() to return NULL if CPU not found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Andreas Färber --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'exec.c') diff --git a/exec.c b/exec.c index 46a2830..0a96ddb 100644 --- a/exec.c +++ b/exec.c @@ -260,7 +260,7 @@ CPUState *qemu_get_cpu(int index) env = env->next_cpu; } - return cpu; + return env ? cpu : NULL; } void cpu_exec_init(CPUArchState *env) -- cgit v1.1