Re: [libvirt PATCH v5 9/9] lxcDomainDetachDeviceHostdevUSBLive: Use VIR_WITH_OBJECT_LOCK_GUARD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 01, 2022 at 02:20:17PM +0100, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
src/lxc/lxc_driver.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 7bc39120ee..42053de9c3 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -4045,9 +4045,9 @@ lxcDomainDetachDeviceHostdevUSBLive(virLXCDriver *driver,
        VIR_WARN("cannot deny device %s for domain %s: %s",
                 dst, vm->def->name, virGetLastErrorMessage());

-    virObjectLock(hostdev_mgr->activeUSBHostdevs);
-    virUSBDeviceListDel(hostdev_mgr->activeUSBHostdevs, usb);
-    virObjectUnlock(hostdev_mgr->activeUSBHostdevs);
+    VIR_WITH_OBJECT_LOCK_GUARD(hostdev_mgr->activeUSBHostdevs) {
+        virUSBDeviceListDel(hostdev_mgr->activeUSBHostdevs, usb);
+    }

Even nicer you can omit the curly brackets and make this a +2/-3 ;)
Otherwise I guess we'd need some kind of stylistic guide to keep us
consistent in this regard right from the start.


    virDomainHostdevRemove(vm->def, idx);
    virDomainHostdevDefFree(def);
--
2.31.1

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux