Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[sfrench/cifs-2.6.git] / arch / x86 / kernel / amd_iommu.c
index fa5a1474cd182db250e189cfc8b262683f2585ba..0d20286d78c6f6b6b4307ef35dc5001cccc480a9 100644 (file)
@@ -1487,6 +1487,7 @@ static int __attach_device(struct device *dev,
                           struct protection_domain *domain)
 {
        struct iommu_dev_data *dev_data, *alias_data;
+       int ret;
 
        dev_data   = get_dev_data(dev);
        alias_data = get_dev_data(dev_data->alias);
@@ -1498,13 +1499,14 @@ static int __attach_device(struct device *dev,
        spin_lock(&domain->lock);
 
        /* Some sanity checks */
+       ret = -EBUSY;
        if (alias_data->domain != NULL &&
            alias_data->domain != domain)
-               return -EBUSY;
+               goto out_unlock;
 
        if (dev_data->domain != NULL &&
            dev_data->domain != domain)
-               return -EBUSY;
+               goto out_unlock;
 
        /* Do real assignment */
        if (dev_data->alias != dev) {
@@ -1520,10 +1522,14 @@ static int __attach_device(struct device *dev,
 
        atomic_inc(&dev_data->bind);
 
+       ret = 0;
+
+out_unlock:
+
        /* ready */
        spin_unlock(&domain->lock);
 
-       return 0;
+       return ret;
 }
 
 /*
@@ -2324,10 +2330,6 @@ int __init amd_iommu_init_dma_ops(void)
 
        iommu_detected = 1;
        swiotlb = 0;
-#ifdef CONFIG_GART_IOMMU
-       gart_iommu_aperture_disabled = 1;
-       gart_iommu_aperture = 0;
-#endif
 
        /* Make the driver finally visible to the drivers */
        dma_ops = &amd_iommu_dma_ops;