intel-iommu: Fix AB-BA lockdep report
[firefly-linux-kernel-4.4.55.git] / drivers / iommu / intel-iommu.c
index c621c98c99da00886931b3aed1b8364c7de6b958..d9514c46177f1c5f90892959d41fe4d0f9aedf99 100644 (file)
@@ -3568,6 +3568,8 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
                        found = 1;
        }
 
+       spin_unlock_irqrestore(&device_domain_lock, flags);
+
        if (found == 0) {
                unsigned long tmp_flags;
                spin_lock_irqsave(&domain->iommu_lock, tmp_flags);
@@ -3584,8 +3586,6 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
                        spin_unlock_irqrestore(&iommu->lock, tmp_flags);
                }
        }
-
-       spin_unlock_irqrestore(&device_domain_lock, flags);
 }
 
 static void vm_domain_remove_all_dev_info(struct dmar_domain *domain)