vl: Avoid unnecessary 'if' nesting
authorEduardo Habkost <ehabkost@redhat.com>
Fri, 19 Dec 2014 02:59:45 +0000 (00:59 -0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 9 Jan 2015 22:41:11 +0000 (23:41 +0100)
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>
vl.c

diff --git a/vl.c b/vl.c
index 1a2da2b36a50b4e255890cf7ada72299e966c404..56a17ddc6b123376652ed9169975bd0a2c3f81a6 100644 (file)
--- 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);