diff options
| author | Daniel Brodsky | 2020-04-04 06:21:08 +0200 |
|---|---|---|
| committer | Stefan Hajnoczi | 2020-05-04 17:07:43 +0200 |
| commit | 6e8a355de6c4d32e9df336cdafb009cd78262836 (patch) | |
| tree | dc839bbdbdfab8c588445a8b9d9283e0dda18d39 /util/vfio-helpers.c | |
| parent | lockable: fix __COUNTER__ macro to be referenced properly (diff) | |
| download | qemu-6e8a355de6c4d32e9df336cdafb009cd78262836.tar.gz qemu-6e8a355de6c4d32e9df336cdafb009cd78262836.tar.xz qemu-6e8a355de6c4d32e9df336cdafb009cd78262836.zip | |
lockable: replaced locks with lock guard macros where appropriate
- ran regexp "qemu_mutex_lock\(.*\).*\n.*if" to find targets
- replaced result with QEMU_LOCK_GUARD if all unlocks at function end
- replaced result with WITH_QEMU_LOCK_GUARD if unlock not at end
Signed-off-by: Daniel Brodsky <dnbrdsky@gmail.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-id: 20200404042108.389635-3-dnbrdsky@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util/vfio-helpers.c')
| -rw-r--r-- | util/vfio-helpers.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c index ddd9a96e76..e399e330e2 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -21,6 +21,7 @@ #include "standard-headers/linux/pci_regs.h" #include "qemu/event_notifier.h" #include "qemu/vfio-helpers.h" +#include "qemu/lockable.h" #include "trace.h" #define QEMU_VFIO_DEBUG 0 @@ -667,14 +668,12 @@ int qemu_vfio_dma_reset_temporary(QEMUVFIOState *s) .size = QEMU_VFIO_IOVA_MAX - s->high_water_mark, }; trace_qemu_vfio_dma_reset_temporary(s); - qemu_mutex_lock(&s->lock); + QEMU_LOCK_GUARD(&s->lock); if (ioctl(s->container, VFIO_IOMMU_UNMAP_DMA, &unmap)) { error_report("VFIO_UNMAP_DMA failed: %s", strerror(errno)); - qemu_mutex_unlock(&s->lock); return -errno; } s->high_water_mark = QEMU_VFIO_IOVA_MAX; - qemu_mutex_unlock(&s->lock); return 0; } |
