diff options
Diffstat (limited to 'drivers/iommu/amd_iommu.c')
-rw-r--r-- | drivers/iommu/amd_iommu.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 98f555dafb55..b287ca33833d 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -2466,18 +2466,16 @@ static int device_change_notifier(struct notifier_block *nb, | |||
2466 | 2466 | ||
2467 | /* allocate a protection domain if a device is added */ | 2467 | /* allocate a protection domain if a device is added */ |
2468 | dma_domain = find_protection_domain(devid); | 2468 | dma_domain = find_protection_domain(devid); |
2469 | if (dma_domain) | 2469 | if (!dma_domain) { |
2470 | goto out; | 2470 | dma_domain = dma_ops_domain_alloc(); |
2471 | dma_domain = dma_ops_domain_alloc(); | 2471 | if (!dma_domain) |
2472 | if (!dma_domain) | 2472 | goto out; |
2473 | goto out; | 2473 | dma_domain->target_dev = devid; |
2474 | dma_domain->target_dev = devid; | 2474 | |
2475 | 2475 | spin_lock_irqsave(&iommu_pd_list_lock, flags); | |
2476 | spin_lock_irqsave(&iommu_pd_list_lock, flags); | 2476 | list_add_tail(&dma_domain->list, &iommu_pd_list); |
2477 | list_add_tail(&dma_domain->list, &iommu_pd_list); | 2477 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); |
2478 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); | 2478 | } |
2479 | |||
2480 | dev_data = get_dev_data(dev); | ||
2481 | 2479 | ||
2482 | dev->archdata.dma_ops = &amd_iommu_dma_ops; | 2480 | dev->archdata.dma_ops = &amd_iommu_dma_ops; |
2483 | 2481 | ||