Skip to content

Commit

Permalink
cpu: Fix qemu_get_cpu() to return NULL if CPU not found
Browse files Browse the repository at this point in the history
Commit 55e5c28 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 <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
  • Loading branch information
Igor Mammedov authored and afaerber committed Mar 12, 2013
1 parent fe3cc14 commit d76fdda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d76fdda

Please sign in to comment.