File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -2891,14 +2891,11 @@ static int iommu_setup_default_domain(struct iommu_group *group,
28912891 ret = __iommu_group_set_domain_internal (
28922892 group , dom , IOMMU_SET_DOMAIN_MUST_SUCCEED );
28932893 if (WARN_ON (ret ))
2894- goto out_free ;
2894+ goto out_free_old ;
28952895 } else {
28962896 ret = __iommu_group_set_domain (group , dom );
2897- if (ret ) {
2898- iommu_domain_free (dom );
2899- group -> default_domain = old_dom ;
2900- return ret ;
2901- }
2897+ if (ret )
2898+ goto err_restore_def_domain ;
29022899 }
29032900
29042901 /*
@@ -2911,20 +2908,24 @@ static int iommu_setup_default_domain(struct iommu_group *group,
29112908 for_each_group_device (group , gdev ) {
29122909 ret = iommu_create_device_direct_mappings (dom , gdev -> dev );
29132910 if (ret )
2914- goto err_restore ;
2911+ goto err_restore_domain ;
29152912 }
29162913 }
29172914
2918- err_restore :
2919- if (old_dom ) {
2915+ out_free_old :
2916+ if (old_dom )
2917+ iommu_domain_free (old_dom );
2918+ return ret ;
2919+
2920+ err_restore_domain :
2921+ if (old_dom )
29202922 __iommu_group_set_domain_internal (
29212923 group , old_dom , IOMMU_SET_DOMAIN_MUST_SUCCEED );
2924+ err_restore_def_domain :
2925+ if (old_dom ) {
29222926 iommu_domain_free (dom );
2923- old_dom = NULL ;
2927+ group -> default_domain = old_dom ;
29242928 }
2925- out_free :
2926- if (old_dom )
2927- iommu_domain_free (old_dom );
29282929 return ret ;
29292930}
29302931
You can’t perform that action at this time.
0 commit comments