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

[Xen-changelog] [xen master] libxl: fix coding style issues in init_acpi_config



commit 546c21afe1c84266d22055d16c9122899f9f6a21
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Fri Dec 16 17:40:09 2016 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Dec 21 16:32:13 2016 +0000

    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.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_x86_acpi.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c
index 173188f..c0a6e32 100644
--- a/tools/libxl/libxl_x86_acpi.c
+++ b/tools/libxl/libxl_x86_acpi.c
@@ -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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.