Skip to content

Commit

Permalink
iommu/amd: Handle errors returned from iommu_init_device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joerg Roedel committed Jun 11, 2015
1 parent 409e553 commit 4d58b8a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2265,15 +2265,22 @@ 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;
}
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 */
Expand Down

0 comments on commit 4d58b8a

Please sign in to comment.