diff mbox

libxc: simplify error handling in meminit_hvm

Message ID 1457021381-10372-1-git-send-email-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu March 3, 2016, 4:09 p.m. UTC
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>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Roger Pau Monne <roger.pau@citrix.com>
---
 tools/libxc/xc_dom_x86.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Douglas Goldstein March 7, 2016, 4:02 p.m. UTC | #1
On 3/3/16 10:09 AM, Wei Liu wrote:
> 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>
Roger Pau Monne March 7, 2016, 4:12 p.m. UTC | #2
On Thu, 3 Mar 2016, Wei Liu wrote:

> 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>

Acked-by: Roger Pau Monné <roger.pau@citrix.com>
diff mbox

Patch

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");