aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-06-11 09:21:39 +0200
committerJoerg Roedel <jroedel@suse.de>2015-06-11 09:42:25 +0200
commit4d58b8a6de6b8c3611f10124f83e90e5a2406437 (patch)
tree6f0503e44e1776dabe7a70cbe71c4523b5581180 /drivers/iommu
parentiommu: Checking for NULL instead of IS_ERR (diff)
downloadlinux-dev-4d58b8a6de6b8c3611f10124f83e90e5a2406437.tar.xz
linux-dev-4d58b8a6de6b8c3611f10124f83e90e5a2406437.zip
iommu/amd: Handle errors returned from iommu_init_device
Without this patch only -ENOTSUPP is handled, but there are other possible errors. Handle them too. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 8bc6f40edf5e..e5b77d398e9b 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2265,7 +2265,11 @@ static int amd_iommu_add_device(struct device *dev)
iommu = amd_iommu_rlookup_table[devid];
ret = iommu_init_device(dev);
- if (ret == -ENOTSUPP) {
+ if (ret) {
+ if (ret != -ENOTSUPP)
+ pr_err("Failed to initialize device %s - trying to proceed anyway\n",
+ dev_name(dev));
+
iommu_ignore_device(dev);
dev->archdata.dma_ops = &nommu_dma_ops;
goto out;
@@ -2273,7 +2277,10 @@ static int amd_iommu_add_device(struct device *dev)
init_iommu_group(dev);
dev_data = get_dev_data(dev);
- if (dev_data && dev_data->iommu_v2)
+
+ BUG_ON(!dev_data);
+
+ if (dev_data->iommu_v2)
iommu_request_dm_for_dev(dev);
/* Domains are initialized for this device - have a look what we ended up with */