This patch ensures that all devices will be first detached from the
provided domain and then attached to the default_domain if such has been
provided.

Signed-off-by: Marek Szyprowski <[email protected]>
---
 drivers/iommu/iommu.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index db231ad..045efb0 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1246,14 +1246,14 @@ static void __iommu_detach_group(struct iommu_domain 
*domain,
 {
        int ret;
 
-       if (!group->default_domain) {
-               __iommu_group_for_each_dev(group, domain,
-                                          iommu_group_do_detach_device);
-               group->domain = NULL;
+       if (group->domain == group->default_domain)
                return;
-       }
 
-       if (group->domain == group->default_domain)
+       __iommu_group_for_each_dev(group, domain,
+                                  iommu_group_do_detach_device);
+       group->domain = NULL;
+
+       if (!group->default_domain)
                return;
 
        /* Detach by re-attaching to the default domain */
-- 
1.9.2

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to