Skip to contentSkip to conversation

libxl: fix coding style issues in init_acpi_config

PATCH In review Wei Liu 2 participants 2 messages Dec 16, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxl: fix coding style issues in init_acpi_config

1. Use "r" to store return values from xc calls.
2. Don't initialise "rc" at the beginning of the function.

---
 tools/libxl/libxl_x86_acpi.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)
tools/libxl/libxl_x86_acpi.c +17 -14
index 173188f..c0a6e32 100644
@@ -98,14 +98,15 @@ static int init_acpi_config(libxl__gc *gc,
     uint32_t domid = dom->guest_domid;
     xc_dominfo_t info;
     struct hvm_info_table *hvminfo;
-    int i, rc = 0;
+    int i, r, rc;
 
     config->dsdt_anycpu = config->dsdt_15cpu = dsdt_pvh;
     config->dsdt_anycpu_len = config->dsdt_15cpu_len = dsdt_pvh_len;
 
-    rc = xc_domain_getinfo(xch, domid, 1, &info);
-    if (rc < 0) {
-        LOG(ERROR, "getdomaininfo failed (rc=%d)", rc);
+    r = xc_domain_getinfo(xch, domid, 1, &info);
+    if (r < 0) {
+        LOG(ERROR, "getdomaininfo failed (rc=%d)", r);
+        rc = ERROR_FAIL;
         goto out;
     }
 
@@ -118,11 +119,12 @@ static int init_acpi_config(libxl__gc *gc,
         struct xen_vmemrange *vmemrange;
         struct acpi_numa *numa = &config->numa;
 
-        rc = xc_domain_getvnuma(xch, domid, &numa->nr_vnodes,
-                                &numa->nr_vmemranges,
-                                &hvminfo->nr_vcpus, NULL, NULL, NULL);
-        if (rc) {
-            LOG(ERROR, "xc_domain_getvnuma failed (rc=%d)", rc);
+        r = xc_domain_getvnuma(xch, domid, &numa->nr_vnodes,
+                               &numa->nr_vmemranges,
+                               &hvminfo->nr_vcpus, NULL, NULL, NULL);
+        if (r) {
+            LOG(ERROR, "xc_domain_getvnuma failed (rc=%d)", r);
+            rc = ERROR_FAIL;
             goto out;
         }
 
@@ -130,11 +132,12 @@ static int init_acpi_config(libxl__gc *gc,
         vdistance = libxl__zalloc(gc, dom->nr_vnodes * sizeof(*vdistance));
         vcpu_to_vnode = libxl__zalloc(gc, hvminfo->nr_vcpus *
                                       sizeof(*vcpu_to_vnode));
-        rc = xc_domain_getvnuma(xch, domid, &numa->nr_vnodes,
-                                &numa->nr_vmemranges, &hvminfo->nr_vcpus,
-                                vmemrange, vdistance, vcpu_to_vnode);
-	if (rc) {
-            LOG(ERROR, "xc_domain_getvnuma failed (rc=%d)", rc);
+        r = xc_domain_getvnuma(xch, domid, &numa->nr_vnodes,
+                               &numa->nr_vmemranges, &hvminfo->nr_vcpus,
+                               vmemrange, vdistance, vcpu_to_vnode);
+        if (r) {
+            LOG(ERROR, "xc_domain_getvnuma failed (rc=%d)", r);
+            rc = ERROR_FAIL;
             goto out;
         }
         numa->vmemrange = vmemrange;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw

Wei Liu writes ("[PATCH] libxl: fix coding style issues in init_acpi_config"):

Quoted 4 lines

1. Use "r" to store return values from xc calls.
2. Don't initialise "rc" at the beginning of the function.

Right, that's what I meant.,

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel