]> xenbits.xensource.com Git - xen.git/commitdiff
libxc: simplify error handling in meminit_hvm
authorWei Liu <wei.liu2@citrix.com>
Thu, 3 Mar 2016 16:01:58 +0000 (16:01 +0000)
committerWei Liu <wei.liu2@citrix.com>
Thu, 10 Mar 2016 18:40:17 +0000 (18:40 +0000)
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 <cardoe@cardoe.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Roger Pau Monne <roger.pau@citrix.com>
tools/libxc/xc_dom_x86.c

index e13a4aa01fd08e3b9b8b76eb3424e4a6d8ebc2dd..bdec40ad1f490c12beed3d1fe6150c9b14abaddd 100644 (file)
@@ -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");