[libvirt PATCH 1/3] cpu: Change control flow in virCPUUpdateLive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/cpu/cpu.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 6d6191fe4e..c461c4839d 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -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;
 }
 
 
-- 
2.25.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux