Skip to contentSkip to conversation

libxc: simplify error handling in meminit_hvm

PATCH In review Wei Liu 3 participants 3 messages Mar 3, 2016 – Mar 7, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxc: simplify error handling in meminit_hvm

The hunk that prints out error message can only be reached from the loop that allocates memory. Move that hunk into the loop to avoid confusing gcc.

---
Cc: Ian Jackson <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Roger Pau Monne <[email protected]>

---
 tools/libxc/xc_dom_x86.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
tools/libxc/xc_dom_x86.c +4 -7
index e13a4aa..bdec40a 100644
@@ -1550,13 +1550,10 @@ static int meminit_hvm(struct xc_dom_image *dom)
         }
 
         if ( rc != 0 )
-            break;
-    }
-
-    if ( rc != 0 )
-    {
-        DOMPRINTF("Could not allocate memory for HVM guest.");
-        goto error_out;
+        {
+            DOMPRINTF("Could not allocate memory for HVM guest.");
+            goto error_out;
+        }
     }
 
     DPRINTF("PHYSICAL MEMORY ALLOCATION:\n");
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Wei Liu

The hunk that prints out error message can only be reached from the loop that allocates memory. Move that hunk into the loop to avoid confusing gcc.

---

Signature · 1 line
Doug Goldstein

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

Acked-by on v1 1/1
#2 lore raw
In reply to Wei Liu
Quoted 6 lines · Wei Liu

The hunk that prints out error message can only be reached from the loop that allocates memory. Move that hunk into the loop to avoid confusing gcc.

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