diff options
| author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2024-05-07 14:42:44 +0800 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2024-05-16 16:59:20 +0200 |
| commit | b77548355ab5d8c8377ba8f981c7c597507de37a (patch) | |
| tree | e70d40f836675b943ee765c32bf6b7f41b89b029 /hw/vfio/iommufd.c | |
| parent | f3758413b77d396dd4db68643f7068fb49ec77d9 (diff) | |
| download | focaccia-qemu-b77548355ab5d8c8377ba8f981c7c597507de37a.tar.gz focaccia-qemu-b77548355ab5d8c8377ba8f981c7c597507de37a.zip | |
vfio: Make VFIOIOMMUClass::attach_device() and its wrapper return bool
Make VFIOIOMMUClass::attach_device() and its wrapper function vfio_attach_device() return bool. This is to follow the coding standand to return bool if 'Error **' is used to pass error. 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/iommufd.c')
| -rw-r--r-- | hw/vfio/iommufd.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index c644127972..4c6992fca1 100644 --- a/hw/vfio/iommufd.c +++ b/hw/vfio/iommufd.c @@ -299,8 +299,8 @@ error: return ret; } -static int iommufd_cdev_attach(const char *name, VFIODevice *vbasedev, - AddressSpace *as, Error **errp) +static bool iommufd_cdev_attach(const char *name, VFIODevice *vbasedev, + AddressSpace *as, Error **errp) { VFIOContainerBase *bcontainer; VFIOIOMMUFDContainer *container; @@ -315,7 +315,7 @@ static int iommufd_cdev_attach(const char *name, VFIODevice *vbasedev, if (vbasedev->fd < 0) { devfd = iommufd_cdev_getfd(vbasedev->sysfsdev, errp); if (devfd < 0) { - return devfd; + return false; } vbasedev->fd = devfd; } else { @@ -392,7 +392,6 @@ static int iommufd_cdev_attach(const char *name, VFIODevice *vbasedev, memory_listener_register(&bcontainer->listener, bcontainer->space->as); if (bcontainer->error) { - ret = -1; error_propagate_prepend(errp, bcontainer->error, "memory listener initialization failed: "); goto err_listener_register; @@ -431,7 +430,7 @@ found_container: trace_iommufd_cdev_device_info(vbasedev->name, devfd, vbasedev->num_irqs, vbasedev->num_regions, vbasedev->flags); - return 0; + return true; err_listener_register: iommufd_cdev_ram_block_discard_disable(false); @@ -444,7 +443,7 @@ err_alloc_ioas: iommufd_cdev_unbind_and_disconnect(vbasedev); err_connect_bind: close(vbasedev->fd); - return ret; + return false; } static void iommufd_cdev_detach(VFIODevice *vbasedev) |