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.

Reported-by: Doug Goldstein <car...@cardoe.com>
Signed-off-by: Wei Liu <wei.l...@citrix.com>
---
Cc: Ian Jackson <ian.jack...@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabell...@eu.citrix.com>
Cc: Roger Pau Monne <roger....@citrix.com>
---
 tools/libxc/xc_dom_x86.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index e13a4aa..bdec40a 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -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");
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to