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

Shivaprasad G Bhat posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/149614326524.20141.6255919371337811367.stgit@localhost.localdomain
src/qemu/qemu_hotplug.c |    6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
[libvirt] [PATCH] qemu: hotplug: Release address properly when redirected device attach failure
Posted by Shivaprasad G Bhat 6 years, 11 months ago
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;

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: hotplug: Release address properly when redirected device attach failure
Posted by John Ferlan 6 years, 10 months ago

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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list