# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1305294079 -3600
# Node ID e2aa33c8019ebd849f87e3d68350e2d26f42b15d
# Parent 5e7615dbe3008fd25edabb3fda3cb80a76015ed1
tools: libxl: fixup error handling in libxl__build_hvm.
We first pointless initialise rc and immediately overwrite the value, then fail
to return it on error anyway...
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r 5e7615dbe300 -r e2aa33c8019e tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Fri May 13 14:41:19 2011 +0100
+++ b/tools/libxl/libxl_dom.c Fri May 13 14:41:19 2011 +0100
@@ -284,15 +284,17 @@ int libxl__build_hvm(libxl__gc *gc, uint
libxl__domain_build_state *state)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
- int ret, rc = ERROR_INVAL;
+ int ret, rc = ERROR_FAIL;
+ const char *firmware = libxl__domain_firmware(gc, info, dm_info);
- rc = ERROR_FAIL;
+ if (!firmware)
+ goto out;
ret = xc_hvm_build_target_mem(
ctx->xch,
domid,
(info->max_memkb - info->video_memkb) / 1024,
(info->target_memkb - info->video_memkb) / 1024,
- libxl__domain_firmware(gc, info, dm_info));
+ firmware);
if (ret) {
LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm building failed");
goto out;
@@ -305,7 +307,7 @@ int libxl__build_hvm(libxl__gc *gc, uint
}
rc = 0;
out:
- return 0;
+ return rc;
}
int libxl__domain_restore_common(libxl__gc *gc, uint32_t domid,
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|