diff mbox

[2/2] iommu: fix default domain handling in __iommu_detach_group()

Message ID 1455633632-16873-3-git-send-email-m.szyprowski@samsung.com
State New
Headers show

Commit Message

Marek Szyprowski Feb. 16, 2016, 2:40 p.m. UTC
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 <m.szyprowski@samsung.com>
---
 drivers/iommu/iommu.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox

Patch

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 */