[PATCH v3 02/13] cpu: turn virCPUx86DataAdd() to void

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

 



virCPUx86DataAdd() always returns 0.

Signed-off-by: Dmitry Frolov <frolov@xxxxxxxxx>
---
 src/cpu/cpu_x86.c              | 66 +++++++++++++---------------------
 src/cpu/cpu_x86.h              |  2 +-
 src/libxl/libxl_capabilities.c |  7 +---
 3 files changed, 26 insertions(+), 49 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index f32770b8a3..4f3bfd075b 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2380,8 +2380,8 @@ x86Encode(virArch arch,
         if (!(data_vendor = virCPUDataNew(arch)))
             return -1;
 
-        if (v && virCPUx86DataAdd(data_vendor, &v->data) < 0)
-            return -1;
+        if (v)
+            virCPUx86DataAdd(data_vendor, &v->data);
     }
 
     if (forced)
@@ -2455,14 +2455,12 @@ cpuidSetLeaf4(virCPUData *data,
     virCPUx86DataItem item = *subLeaf0;
     virCPUx86CPUID *cpuid = &item.data.cpuid;
 
-    if (virCPUx86DataAdd(data, subLeaf0) < 0)
-        return -1;
+    virCPUx86DataAdd(data, subLeaf0);
 
     while (cpuid->eax & 0x1f) {
         cpuid->ecx_in++;
         cpuidCall(cpuid);
-        if (virCPUx86DataAdd(data, &item) < 0)
-            return -1;
+        virCPUx86DataAdd(data, &item);
     }
     return 0;
 }
@@ -2480,14 +2478,12 @@ cpuidSetLeaf7(virCPUData *data,
     virCPUx86CPUID *cpuid = &item.data.cpuid;
     uint32_t sub;
 
-    if (virCPUx86DataAdd(data, subLeaf0) < 0)
-        return -1;
+    virCPUx86DataAdd(data, subLeaf0);
 
     for (sub = 1; sub <= subLeaf0->data.cpuid.eax; sub++) {
         cpuid->ecx_in = sub;
         cpuidCall(cpuid);
-        if (virCPUx86DataAdd(data, &item) < 0)
-            return -1;
+        virCPUx86DataAdd(data, &item);
     }
     return 0;
 }
@@ -2508,8 +2504,7 @@ cpuidSetLeafB(virCPUData *data,
     virCPUx86CPUID *cpuid = &item.data.cpuid;
 
     while (cpuid->ecx & 0xff00) {
-        if (virCPUx86DataAdd(data, &item) < 0)
-            return -1;
+        virCPUx86DataAdd(data, &item);
         cpuid->ecx_in++;
         cpuidCall(cpuid);
     }
@@ -2535,13 +2530,11 @@ cpuidSetLeafD(virCPUData *data,
     virCPUx86CPUID sub1;
     uint32_t sub;
 
-    if (virCPUx86DataAdd(data, subLeaf0) < 0)
-        return -1;
+    virCPUx86DataAdd(data, subLeaf0);
 
     cpuid->ecx_in = 1;
     cpuidCall(cpuid);
-    if (virCPUx86DataAdd(data, &item) < 0)
-        return -1;
+    virCPUx86DataAdd(data, &item);
 
     sub0 = subLeaf0->data.cpuid;
     sub1 = *cpuid;
@@ -2557,8 +2550,7 @@ cpuidSetLeafD(virCPUData *data,
 
         cpuid->ecx_in = sub;
         cpuidCall(cpuid);
-        if (virCPUx86DataAdd(data, &item) < 0)
-            return -1;
+        virCPUx86DataAdd(data, &item);
     }
     return 0;
 }
@@ -2582,16 +2574,14 @@ cpuidSetLeafResID(virCPUData *data,
     virCPUx86CPUID *cpuid = &item.data.cpuid;
     uint32_t sub;
 
-    if (virCPUx86DataAdd(data, subLeaf0) < 0)
-        return -1;
+    virCPUx86DataAdd(data, subLeaf0);
 
     for (sub = 1; sub < 32; sub++) {
         if (!(res & (1U << sub)))
             continue;
         cpuid->ecx_in = sub;
         cpuidCall(cpuid);
-        if (virCPUx86DataAdd(data, &item) < 0)
-            return -1;
+        virCPUx86DataAdd(data, &item);
     }
     return 0;
 }
@@ -2614,20 +2604,17 @@ cpuidSetLeaf12(virCPUData *data,
         !(leaf7->data.cpuid.ebx & (1 << 2)))
         return 0;
 
-    if (virCPUx86DataAdd(data, subLeaf0) < 0)
-        return -1;
+    virCPUx86DataAdd(data, subLeaf0);
 
     cpuid->eax_in = 0x12;
     cpuid->ecx_in = 1;
     cpuidCall(cpuid);
-    if (virCPUx86DataAdd(data, &item) < 0)
-        return -1;
+    virCPUx86DataAdd(data, &item);
 
     cpuid->ecx_in = 2;
     cpuidCall(cpuid);
     while (cpuid->eax & 0xf) {
-        if (virCPUx86DataAdd(data, &item) < 0)
-            return -1;
+        virCPUx86DataAdd(data, &item);
         cpuid->ecx_in++;
         cpuidCall(cpuid);
     }
@@ -2647,14 +2634,12 @@ cpuidSetLeaf14(virCPUData *data,
     virCPUx86CPUID *cpuid = &item.data.cpuid;
     uint32_t sub;
 
-    if (virCPUx86DataAdd(data, subLeaf0) < 0)
-        return -1;
+    virCPUx86DataAdd(data, subLeaf0);
 
     for (sub = 1; sub <= subLeaf0->data.cpuid.eax; sub++) {
         cpuid->ecx_in = sub;
         cpuidCall(cpuid);
-        if (virCPUx86DataAdd(data, &item) < 0)
-            return -1;
+        virCPUx86DataAdd(data, &item);
     }
     return 0;
 }
@@ -2676,14 +2661,12 @@ cpuidSetLeaf17(virCPUData *data,
     if (subLeaf0->data.cpuid.eax < 3)
         return 0;
 
-    if (virCPUx86DataAdd(data, subLeaf0) < 0)
-        return -1;
+    virCPUx86DataAdd(data, subLeaf0);
 
     for (sub = 1; sub <= subLeaf0->data.cpuid.eax; sub++) {
         cpuid->ecx_in = sub;
         cpuidCall(cpuid);
-        if (virCPUx86DataAdd(data, &item) < 0)
-            return -1;
+        virCPUx86DataAdd(data, &item);
     }
     return 0;
 }
@@ -2728,7 +2711,7 @@ cpuidSet(uint32_t base, virCPUData *data)
         else if (leaf == 0x17)
             rc = cpuidSetLeaf17(data, &item);
         else
-            rc = virCPUx86DataAdd(data, &item);
+            virCPUx86DataAdd(data, &item);
 
         if (rc < 0)
             return -1;
@@ -2773,8 +2756,7 @@ virCPUx86GetHost(virCPUDef *cpu,
                 },
             };
 
-            if (virCPUx86DataAdd(cpuData, &item) < 0)
-                return -1;
+            virCPUx86DataAdd(cpuData, &item);
         }
     }
 
@@ -3292,12 +3274,11 @@ virCPUx86ValidateFeatures(virCPUDef *cpu)
 }
 
 
-int
+void
 virCPUx86DataAdd(virCPUData *cpuData,
                  const virCPUx86DataItem *item)
 {
     virCPUx86DataAddItem(&cpuData->data.x86, item);
-    return 0;
 }
 
 
@@ -3334,7 +3315,8 @@ virCPUx86DataSetVendor(virCPUData *cpuData,
     if (virCPUx86VendorToData(vendor, &item) < 0)
         return -1;
 
-    return virCPUx86DataAdd(cpuData, &item);
+    virCPUx86DataAdd(cpuData, &item);
+    return 0;
 }
 
 
diff --git a/src/cpu/cpu_x86.h b/src/cpu/cpu_x86.h
index 416d052776..f0d73a5f40 100644
--- a/src/cpu/cpu_x86.h
+++ b/src/cpu/cpu_x86.h
@@ -25,7 +25,7 @@
 
 extern struct cpuArchDriver cpuDriverX86;
 
-int virCPUx86DataAdd(virCPUData *cpuData,
+void virCPUx86DataAdd(virCPUData *cpuData,
                      const virCPUx86DataItem *cpuid);
 
 int virCPUx86DataSetSignature(virCPUData *cpuData,
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index 177e8b988e..9da0fe851c 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -64,12 +64,7 @@ libxlCapsAddCPUID(virCPUData *data, virCPUx86CPUID *cpuid, ssize_t ncaps)
     item.type = VIR_CPU_X86_DATA_CPUID;
     for (i = 0; i < ncaps; i++) {
         item.data.cpuid = cpuid[i];
-
-        if (virCPUx86DataAdd(data, &item) < 0) {
-            VIR_DEBUG("Failed to add CPUID(%x,%x)",
-                      cpuid[i].eax_in, cpuid[i].ecx_in);
-            return -1;
-        }
+        virCPUx86DataAdd(data, &item);
     }
 
     return 0;
-- 
2.34.1
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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