diff mbox series

[03/14] vfio: remove the iommudata check in vfio_noiommu_attach_group

Message ID 20210825161916.50393-4-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/14] vfio: Move vfio_iommu_group_get() to vfio_register_group_dev() | expand

Commit Message

Christoph Hellwig Aug. 25, 2021, 4:19 p.m. UTC
vfio_noiommu_attach_group has two callers:

 1) __vfio_container_attach_groups is called by vfio_ioctl_set_iommu,
    which just called vfio_iommu_driver_allowed
 2) vfio_group_set_container requires already checks ->noiommu on the
    vfio_group, which is propagated from the iommudata in
    vfio_create_group

so this check is entirely superflous and can be removed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/vfio/vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tian, Kevin Aug. 26, 2021, 1:52 a.m. UTC | #1
> From: Christoph Hellwig <hch@lst.de>
> Sent: Thursday, August 26, 2021 12:19 AM
> 
> vfio_noiommu_attach_group has two callers:
> 
>  1) __vfio_container_attach_groups is called by vfio_ioctl_set_iommu,
>     which just called vfio_iommu_driver_allowed
>  2) vfio_group_set_container requires already checks ->noiommu on the
>     vfio_group, which is propagated from the iommudata in
>     vfio_create_group
> 
> so this check is entirely superflous and can be removed.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

> ---
>  drivers/vfio/vfio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 6705349ed93378..00aeef5bb29abd 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -250,7 +250,7 @@ static long vfio_noiommu_ioctl(void *iommu_data,
>  static int vfio_noiommu_attach_group(void *iommu_data,
>  				     struct iommu_group *iommu_group)
>  {
> -	return iommu_group_get_iommudata(iommu_group) ==
> &noiommu ? 0 : -EINVAL;
> +	return 0;
>  }
> 
>  static void vfio_noiommu_detach_group(void *iommu_data,
> --
> 2.30.2
diff mbox series

Patch

diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 6705349ed93378..00aeef5bb29abd 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -250,7 +250,7 @@  static long vfio_noiommu_ioctl(void *iommu_data,
 static int vfio_noiommu_attach_group(void *iommu_data,
 				     struct iommu_group *iommu_group)
 {
-	return iommu_group_get_iommudata(iommu_group) == &noiommu ? 0 : -EINVAL;
+	return 0;
 }
 
 static void vfio_noiommu_detach_group(void *iommu_data,