]> xenbits.xensource.com Git - xen.git/commitdiff
tools/xl: Fix exit code for `xl vkbattach`
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 11 Feb 2021 18:49:23 +0000 (18:49 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 17 Feb 2021 12:37:08 +0000 (12:37 +0000)
Various version of gcc, when compiling with -Og, complain:

  xl_vkb.c: In function 'main_vkbattach':
  xl_vkb.c:79:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     79 |     return rc;
        |            ^~

The dryrun_only path really does leave rc uninitalised.  Introduce a done
label for success paths to use.

Fixes: a15166af7c3 ("xl: add vkb config parser and CLI")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Ian Jackson <iwj@xenproject.org>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
tools/xl/xl_vkb.c

index f6ed9e05ee261d31f56f1602aeaef25b6fee6ac4..728ac9470b4d1e0f66efaef5af21a5aa755ea66f 100644 (file)
@@ -64,7 +64,7 @@ int main_vkbattach(int argc, char **argv)
         char *json = libxl_device_vkb_to_json(ctx, &vkb);
         printf("vkb: %s\n", json);
         free(json);
-        goto out;
+        goto done;
     }
 
     if (libxl_device_vkb_add(ctx, domid, &vkb, 0)) {
@@ -72,6 +72,7 @@ int main_vkbattach(int argc, char **argv)
         rc = ERROR_FAIL; goto out;
     }
 
+done:
     rc = 0;
 
 out: