Skip to content

Commit e19c399

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Change return type of dmar_insert_one_dev_info()
The dmar_insert_one_dev_info() returns the pass-in domain on success and NULL on failure. This doesn't make much sense. Change it to an integer. Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent cd901e9 commit e19c399

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,10 +2452,9 @@ static bool dev_is_real_dma_subdevice(struct device *dev)
24522452
pci_real_dma_dev(to_pci_dev(dev)) != to_pci_dev(dev);
24532453
}
24542454

2455-
static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
2456-
int bus, int devfn,
2457-
struct device *dev,
2458-
struct dmar_domain *domain)
2455+
static int dmar_insert_one_dev_info(struct intel_iommu *iommu, int bus,
2456+
int devfn, struct device *dev,
2457+
struct dmar_domain *domain)
24592458
{
24602459
struct device_domain_info *info = dev_iommu_priv_get(dev);
24612460
unsigned long flags;
@@ -2468,7 +2467,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
24682467
spin_unlock(&iommu->lock);
24692468
if (ret) {
24702469
spin_unlock_irqrestore(&device_domain_lock, flags);
2471-
return NULL;
2470+
return ret;
24722471
}
24732472
list_add(&info->link, &domain->devices);
24742473
spin_unlock_irqrestore(&device_domain_lock, flags);
@@ -2479,7 +2478,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
24792478
if (ret) {
24802479
dev_err(dev, "PASID table allocation failed\n");
24812480
dmar_remove_one_dev_info(dev);
2482-
return NULL;
2481+
return ret;
24832482
}
24842483

24852484
/* Setup the PASID entry for requests without PASID: */
@@ -2497,17 +2496,18 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
24972496
if (ret) {
24982497
dev_err(dev, "Setup RID2PASID failed\n");
24992498
dmar_remove_one_dev_info(dev);
2500-
return NULL;
2499+
return ret;
25012500
}
25022501
}
25032502

2504-
if (domain_context_mapping(domain, dev)) {
2503+
ret = domain_context_mapping(domain, dev);
2504+
if (ret) {
25052505
dev_err(dev, "Domain context map failed\n");
25062506
dmar_remove_one_dev_info(dev);
2507-
return NULL;
2507+
return ret;
25082508
}
25092509

2510-
return domain;
2510+
return 0;
25112511
}
25122512

25132513
static int iommu_domain_identity_map(struct dmar_domain *domain,
@@ -2585,19 +2585,14 @@ static int __init si_domain_init(int hw)
25852585

25862586
static int domain_add_dev_info(struct dmar_domain *domain, struct device *dev)
25872587
{
2588-
struct dmar_domain *ndomain;
25892588
struct intel_iommu *iommu;
25902589
u8 bus, devfn;
25912590

25922591
iommu = device_to_iommu(dev, &bus, &devfn);
25932592
if (!iommu)
25942593
return -ENODEV;
25952594

2596-
ndomain = dmar_insert_one_dev_info(iommu, bus, devfn, dev, domain);
2597-
if (ndomain != domain)
2598-
return -EBUSY;
2599-
2600-
return 0;
2595+
return dmar_insert_one_dev_info(iommu, bus, devfn, dev, domain);
26012596
}
26022597

26032598
static bool device_has_rmrr(struct device *dev)

0 commit comments

Comments
 (0)