From: Wei Liu Date: Wed, 15 Mar 2017 10:50:19 +0000 (+0000) Subject: libxl/colo: unified exit path for colo_proxy_checkpoint X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2473 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c6e2216783b2572912ee5a7938166a29e244fa37;p=xen.git libxl/colo: unified exit path for colo_proxy_checkpoint Slightly refactor the code to have only one exit path for the said function. Signed-off-by: Wei Liu Acked-by: Zhang Chen --- diff --git a/tools/libxl/libxl_colo_proxy.c b/tools/libxl/libxl_colo_proxy.c index c3d55104ea..5475f7ea32 100644 --- a/tools/libxl/libxl_colo_proxy.c +++ b/tools/libxl/libxl_colo_proxy.c @@ -375,7 +375,7 @@ typedef struct colo_msg { int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, unsigned int timeout_us) { - uint8_t *buff; + uint8_t *buff = NULL; int64_t size; struct nlmsghdr *h; struct colo_msg *m; @@ -396,7 +396,7 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, ret = colo_userspace_proxy_recv(cps, recvbuff, timeout_us); if (ret <= 0) { ret = 0; - goto out1; + goto out; } if (!strcmp(recvbuff, "DO_CHECKPOINT")) { @@ -405,14 +405,16 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, LOGD(ERROR, ao->domid, "receive qemu colo-compare checkpoint error"); ret = 0; } - goto out1; + goto out; } size = colo_proxy_recv(cps, &buff, timeout_us); /* timeout, return no checkpoint message. */ - if (size <= 0) - return 0; + if (size <= 0) { + ret = 0; + goto out; + } h = (struct nlmsghdr *) buff; @@ -433,7 +435,4 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps, out: free(buff); return ret; - -out1: - return ret; }