aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/intel-iommu.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index bf2fbaad5e22..abab245371ee 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2287,12 +2287,6 @@ static int domain_add_dev_info(struct dmar_domain *domain,
2287 if (!info) 2287 if (!info)
2288 return -ENOMEM; 2288 return -ENOMEM;
2289 2289
2290 ret = domain_context_mapping(domain, pdev, translation);
2291 if (ret) {
2292 free_devinfo_mem(info);
2293 return ret;
2294 }
2295
2296 info->segment = pci_domain_nr(pdev->bus); 2290 info->segment = pci_domain_nr(pdev->bus);
2297 info->bus = pdev->bus->number; 2291 info->bus = pdev->bus->number;
2298 info->devfn = pdev->devfn; 2292 info->devfn = pdev->devfn;
@@ -2305,6 +2299,17 @@ static int domain_add_dev_info(struct dmar_domain *domain,
2305 pdev->dev.archdata.iommu = info; 2299 pdev->dev.archdata.iommu = info;
2306 spin_unlock_irqrestore(&device_domain_lock, flags); 2300 spin_unlock_irqrestore(&device_domain_lock, flags);
2307 2301
2302 ret = domain_context_mapping(domain, pdev, translation);
2303 if (ret) {
2304 spin_lock_irqsave(&device_domain_lock, flags);
2305 list_del(&info->link);
2306 list_del(&info->global);
2307 pdev->dev.archdata.iommu = NULL;
2308 spin_unlock_irqrestore(&device_domain_lock, flags);
2309 free_devinfo_mem(info);
2310 return ret;
2311 }
2312
2308 return 0; 2313 return 0;
2309} 2314}
2310 2315