diff options
| author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2024-05-22 12:39:59 +0800 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2024-05-22 10:04:21 +0200 |
| commit | 84e37d02969ca1c7a6a8670e7d1da8e4ca5d56b9 (patch) | |
| tree | c36aeef25f3884d92bf7cf5ccf0a05299948c30e /hw/vfio/helpers.c | |
| parent | 50b632b64ce460844089ddd5061460d8b119df5d (diff) | |
| download | focaccia-qemu-84e37d02969ca1c7a6a8670e7d1da8e4ca5d56b9.tar.gz focaccia-qemu-84e37d02969ca1c7a6a8670e7d1da8e4ca5d56b9.zip | |
vfio/helpers: Make vfio_set_irq_signaling() return bool
This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/helpers.c')
| -rw-r--r-- | hw/vfio/helpers.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c index 1f3bdd9bf0..9edbc96688 100644 --- a/hw/vfio/helpers.c +++ b/hw/vfio/helpers.c @@ -107,12 +107,12 @@ static const char *index_to_str(VFIODevice *vbasedev, int index) } } -int vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex, - int action, int fd, Error **errp) +bool vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex, + int action, int fd, Error **errp) { ERRP_GUARD(); g_autofree struct vfio_irq_set *irq_set = NULL; - int argsz, ret = 0; + int argsz; const char *name; int32_t *pfd; @@ -127,15 +127,11 @@ int vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex, pfd = (int32_t *)&irq_set->data; *pfd = fd; - if (ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set)) { - ret = -errno; + if (!ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set)) { + return true; } - if (!ret) { - return 0; - } - - error_setg_errno(errp, -ret, "VFIO_DEVICE_SET_IRQS failure"); + error_setg_errno(errp, errno, "VFIO_DEVICE_SET_IRQS failure"); name = index_to_str(vbasedev, index); if (name) { @@ -146,7 +142,7 @@ int vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex, error_prepend(errp, "Failed to %s %s eventfd signaling for interrupt ", fd < 0 ? "tear down" : "set up", action_to_str(action)); - return ret; + return false; } /* |