aboutsummaryrefslogtreecommitdiff
path: root/util/vfio-helpers.c
diff options
context:
space:
mode:
authorNikita Ivanov <nivanov@cloudlinux.com>2022-10-23 12:04:22 +0300
committerThomas Huth <thuth@redhat.com>2023-01-09 13:50:47 +0100
commit37b0b24e933c18269dddbf6b83f91823cacf8105 (patch)
treeb36ac8d45a9e188604e44998974d27cf6185e0f3 /util/vfio-helpers.c
parent8b6aa69365ca6e9bbc3bf557a6ccc5ed2b468bec (diff)
downloadqemu-37b0b24e933c18269dddbf6b83f91823cacf8105.zip
qemu-37b0b24e933c18269dddbf6b83f91823cacf8105.tar.gz
qemu-37b0b24e933c18269dddbf6b83f91823cacf8105.tar.bz2
error handling: Use RETRY_ON_EINTR() macro where applicable
There is a defined RETRY_ON_EINTR() macro in qemu/osdep.h which handles the same while loop. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/415 Signed-off-by: Nikita Ivanov <nivanov@cloudlinux.com> Message-Id: <20221023090422.242617-3-nivanov@cloudlinux.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> [thuth: Dropped the hunk that changed socket_accept() in libqtest.c] Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'util/vfio-helpers.c')
-rw-r--r--util/vfio-helpers.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index 7a84b1d..2d8af38 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -240,9 +240,9 @@ static int qemu_vfio_pci_read_config(QEMUVFIOState *s, void *buf,
s->config_region_info.offset,
s->config_region_info.size);
assert(QEMU_IS_ALIGNED(s->config_region_info.offset + ofs, size));
- do {
- ret = pread(s->device, buf, size, s->config_region_info.offset + ofs);
- } while (ret == -1 && errno == EINTR);
+ ret = RETRY_ON_EINTR(
+ pread(s->device, buf, size, s->config_region_info.offset + ofs)
+ );
return ret == size ? 0 : -errno;
}
@@ -254,9 +254,9 @@ static int qemu_vfio_pci_write_config(QEMUVFIOState *s, void *buf, int size, int
s->config_region_info.offset,
s->config_region_info.size);
assert(QEMU_IS_ALIGNED(s->config_region_info.offset + ofs, size));
- do {
- ret = pwrite(s->device, buf, size, s->config_region_info.offset + ofs);
- } while (ret == -1 && errno == EINTR);
+ ret = RETRY_ON_EINTR(
+ pwrite(s->device, buf, size, s->config_region_info.offset + ofs)
+ );
return ret == size ? 0 : -errno;
}