Commit d76fddae authored by Igor Mammedov's avatar Igor Mammedov Committed by Andreas Färber
Browse files

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



Commit 55e5c285 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: default avatarIgor Mammedov <imammedo@redhat.com>
Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
parent fe3cc14f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)