Skip to content

Commit 4c8ad9d

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu: Use __iommu_group_set_domain() in iommu_change_dev_def_domain()
This is missing re-attach error handling if the attach fails, use the common code. The ugly "group->domain = prev_domain" will be cleaned in a later patch. Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/5-v5-1b99ae392328+44574-iommu_err_unwind_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent ecd60dc commit 4c8ad9d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/iommu/iommu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,11 +2946,12 @@ static int iommu_change_dev_def_domain(struct iommu_group *group,
29462946
if (ret)
29472947
goto restore_old_domain;
29482948

2949-
ret = iommu_group_create_direct_mappings(group);
2949+
group->domain = prev_dom;
2950+
ret = iommu_create_device_direct_mappings(group, dev);
29502951
if (ret)
29512952
goto free_new_domain;
29522953

2953-
ret = __iommu_attach_group(group->default_domain, group);
2954+
ret = __iommu_group_set_domain(group, group->default_domain);
29542955
if (ret)
29552956
goto free_new_domain;
29562957

@@ -2962,7 +2963,6 @@ static int iommu_change_dev_def_domain(struct iommu_group *group,
29622963
iommu_domain_free(group->default_domain);
29632964
restore_old_domain:
29642965
group->default_domain = prev_dom;
2965-
group->domain = prev_dom;
29662966

29672967
return ret;
29682968
}

0 commit comments

Comments
 (0)