@@ -2452,10 +2452,9 @@ static bool dev_is_real_dma_subdevice(struct device *dev)
2452
2452
pci_real_dma_dev (to_pci_dev (dev )) != to_pci_dev (dev );
2453
2453
}
2454
2454
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 )
2459
2458
{
2460
2459
struct device_domain_info * info = dev_iommu_priv_get (dev );
2461
2460
unsigned long flags ;
@@ -2468,7 +2467,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
2468
2467
spin_unlock (& iommu -> lock );
2469
2468
if (ret ) {
2470
2469
spin_unlock_irqrestore (& device_domain_lock , flags );
2471
- return NULL ;
2470
+ return ret ;
2472
2471
}
2473
2472
list_add (& info -> link , & domain -> devices );
2474
2473
spin_unlock_irqrestore (& device_domain_lock , flags );
@@ -2479,7 +2478,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
2479
2478
if (ret ) {
2480
2479
dev_err (dev , "PASID table allocation failed\n" );
2481
2480
dmar_remove_one_dev_info (dev );
2482
- return NULL ;
2481
+ return ret ;
2483
2482
}
2484
2483
2485
2484
/* 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,
2497
2496
if (ret ) {
2498
2497
dev_err (dev , "Setup RID2PASID failed\n" );
2499
2498
dmar_remove_one_dev_info (dev );
2500
- return NULL ;
2499
+ return ret ;
2501
2500
}
2502
2501
}
2503
2502
2504
- if (domain_context_mapping (domain , dev )) {
2503
+ ret = domain_context_mapping (domain , dev );
2504
+ if (ret ) {
2505
2505
dev_err (dev , "Domain context map failed\n" );
2506
2506
dmar_remove_one_dev_info (dev );
2507
- return NULL ;
2507
+ return ret ;
2508
2508
}
2509
2509
2510
- return domain ;
2510
+ return 0 ;
2511
2511
}
2512
2512
2513
2513
static int iommu_domain_identity_map (struct dmar_domain * domain ,
@@ -2585,19 +2585,14 @@ static int __init si_domain_init(int hw)
2585
2585
2586
2586
static int domain_add_dev_info (struct dmar_domain * domain , struct device * dev )
2587
2587
{
2588
- struct dmar_domain * ndomain ;
2589
2588
struct intel_iommu * iommu ;
2590
2589
u8 bus , devfn ;
2591
2590
2592
2591
iommu = device_to_iommu (dev , & bus , & devfn );
2593
2592
if (!iommu )
2594
2593
return - ENODEV ;
2595
2594
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 );
2601
2596
}
2602
2597
2603
2598
static bool device_has_rmrr (struct device * dev )
0 commit comments