aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2014-12-19 00:59:45 -0200
committerPaolo Bonzini <pbonzini@redhat.com>2015-01-09 23:41:11 +0100
commit719cac1ce20c8806303793b2501aedb9edf1bca3 (patch)
tree454f00dd9242c4cf965e99a7b1e8a8bc1c2cd86a
parent4d91558d60c229f34819329728cf46ff71e13935 (diff)
vl: Avoid unnecessary 'if' nesting
Just a coding style change, to make other changes easier to review. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--vl.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/vl.c b/vl.c
index 1a2da2b36a..56a17ddc6b 100644
--- a/vl.c
+++ b/vl.c
@@ -1170,13 +1170,11 @@ static void smp_parse(QemuOpts *opts)
if (cpus == 0) {
cpus = cores * threads * sockets;
}
+ } else if (cores == 0) {
+ threads = threads > 0 ? threads : 1;
+ cores = cpus / (sockets * threads);
} else {
- if (cores == 0) {
- threads = threads > 0 ? threads : 1;
- cores = cpus / (sockets * threads);
- } else {
- threads = cpus / (cores * sockets);
- }
+ threads = cpus / (cores * sockets);
}
max_cpus = qemu_opt_get_number(opts, "maxcpus", 0);