From: Ján Tomko Date: Fri, 10 Dec 2021 16:41:56 +0000 (+0100) Subject: bhyve: refactor bhyveProbeCapsDeviceHelper X-Git-Tag: v8.0.0-rc1~241 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5316be7a11bbfab2ce75a3edf903091165a493c;p=thirdparty%2Flibvirt.git bhyve: refactor bhyveProbeCapsDeviceHelper Use g_auto and remove the 'ret' variable, as well as the cleanup label. Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c index ed0df35518..421d0622cd 100644 --- a/src/bhyve/bhyve_capabilities.c +++ b/src/bhyve/bhyve_capabilities.c @@ -199,24 +199,20 @@ bhyveProbeCapsDeviceHelper(unsigned int *caps, const char *errormsg, unsigned int flag) { - char *error; - virCommand *cmd = NULL; - int ret = -1, exit; + g_autofree char *error = NULL; + g_autoptr(virCommand) cmd = NULL; + int exit; cmd = virCommandNew(binary); virCommandAddArgList(cmd, bus, device, NULL); virCommandSetErrorBuffer(cmd, &error); if (virCommandRun(cmd, &exit) < 0) - goto cleanup; + return -1; if (strstr(error, errormsg) == NULL) *caps |= flag; - ret = 0; - cleanup: - VIR_FREE(error); - virCommandFree(cmd); - return ret; + return 0; } static int