Skip to content

Commit d9dfb5e

Browse files
yiliu1765jgunthorpe
authored andcommitted
iommufd: Avoid duplicated __iommu_group_set_core_domain() call
For the fault-capable hwpts, the iommufd_hwpt_detach_device() calls both iommufd_fault_domain_detach_dev() and iommu_detach_group(). This would have duplicated __iommu_group_set_core_domain() call since both functions call it in the end. This looks no harm as the __iommu_group_set_core_domain() returns if the new domain equals to the existing one. But it makes sense to avoid such duplicated calls in caller side. Link: https://patch.msgid.link/r/[email protected] Signed-off-by: Yi Liu <[email protected]> Reviewed-by: Lu Baolu <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 8f68873 commit d9dfb5e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/iommu/iommufd/iommufd_private.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,10 @@ static inline int iommufd_hwpt_attach_device(struct iommufd_hw_pagetable *hwpt,
510510
static inline void iommufd_hwpt_detach_device(struct iommufd_hw_pagetable *hwpt,
511511
struct iommufd_device *idev)
512512
{
513-
if (hwpt->fault)
513+
if (hwpt->fault) {
514514
iommufd_fault_domain_detach_dev(hwpt, idev);
515+
return;
516+
}
515517

516518
iommu_detach_group(hwpt->domain, idev->igroup->group);
517519
}

0 commit comments

Comments
 (0)