From 719cac1ce20c8806303793b2501aedb9edf1bca3 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 19 Dec 2014 00:59:45 -0200 Subject: [PATCH] vl: Avoid unnecessary 'if' nesting Just a coding style change, to make other changes easier to review. Signed-off-by: Eduardo Habkost Reviewed-by: Andrew Jones Signed-off-by: Paolo Bonzini --- vl.c | 10 ++++------ 1 file 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); -- 2.11.0