]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cpu: Change control flow in virCPUUpdateLive
authorJiri Denemark <jdenemar@redhat.com>
Mon, 9 Mar 2020 09:30:39 +0000 (10:30 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 17 Mar 2020 21:53:53 +0000 (22:53 +0100)
The updateLive CPU sub-driver function is supposed to be called only for
a subset of CPU definitions. Let's make it more obvious by turning a
negative test and return into a positive check.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/cpu/cpu.c

index 6d6191fe4e5fd8f65a42701e39a7a22a42d42c5b..c461c4839de12f00a6e40b2d49e9328376f0d0ec 100644 (file)
@@ -647,13 +647,14 @@ virCPUUpdateLive(virArch arch,
     if (!driver->updateLive)
         return 1;
 
-    if (cpu->mode != VIR_CPU_MODE_CUSTOM)
-        return 1;
+    if (cpu->mode == VIR_CPU_MODE_CUSTOM) {
+        if (driver->updateLive(cpu, dataEnabled, dataDisabled) < 0)
+            return -1;
 
-    if (driver->updateLive(cpu, dataEnabled, dataDisabled) < 0)
-        return -1;
+        return 0;
+    }
 
-    return 0;
+    return 1;
 }