[libvirt] [PATCH] qemu: hotplug: Release address properly when redirected device attach failure

The virDomainUSBAddressEnsure returns 0 or -1 and checking for 1 is wrong. Fix it. Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com> --- src/qemu/qemu_hotplug.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 4a7d997..f339148 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1707,7 +1707,6 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn, virDomainRedirdevDefPtr redirdev) { int ret = -1; - int rc; qemuDomainObjPrivatePtr priv = vm->privateData; virDomainDefPtr def = vm->def; char *charAlias = NULL; @@ -1724,10 +1723,9 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn, if (!(charAlias = qemuAliasChardevFromDevAlias(redirdev->info.alias))) goto cleanup; - if ((rc = virDomainUSBAddressEnsure(priv->usbaddrs, &redirdev->info)) < 0) + if ((virDomainUSBAddressEnsure(priv->usbaddrs, &redirdev->info)) < 0) goto cleanup; - if (rc == 1) - need_release = true; + need_release = true; if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->qemuCaps))) goto cleanup;

On 05/30/2017 07:22 AM, Shivaprasad G Bhat wrote:
The virDomainUSBAddressEnsure returns 0 or -1 and checking for 1 is wrong. Fix it.
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com> --- src/qemu/qemu_hotplug.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Reviewed-by: John Ferlan <jferlan@redhat.com> FWIW: It seems commit id de325472 copied the logic from qemuDomainAttachChrDeviceAssignAddr... I altered the commit message slightly and pushed.... Tks, John
participants (2)
-
John Ferlan
-
Shivaprasad G Bhat