Get rid of the 'need_release' variable. Signed-off-by: Yi Li <yili@xxxxxxxxxxx> --- src/qemu/qemu_hotplug.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 882e5d2384..e07dba3c5e 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1921,18 +1921,16 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, bool chardevAdded = false; g_autofree char *tlsAlias = NULL; const char *secAlias = NULL; - bool need_release = false; virErrorPtr orig_err; if (qemuAssignDeviceRedirdevAlias(def, redirdev, -1) < 0) - goto cleanup; + return -1; if (!(charAlias = qemuAliasChardevFromDevAlias(redirdev->info.alias))) - goto cleanup; + return -1; if ((virDomainUSBAddressEnsure(priv->usbaddrs, &redirdev->info)) < 0) - goto cleanup; - need_release = true; + return -1; if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->qemuCaps))) goto cleanup; @@ -1964,7 +1962,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, audit: virDomainAuditRedirdev(vm, redirdev, "attach", ret == 0); cleanup: - if (ret < 0 && need_release) + if (ret < 0) qemuDomainReleaseDeviceAddress(vm, &redirdev->info); return ret; -- 2.25.3