summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-06-10 13:59:27 +0300
committerJoerg Roedel <jroedel@suse.de>2015-06-11 09:42:25 +0200
commit409e553deeeb08d644ed1110e0f1c97b71cb6409 (patch)
tree276c6a82017f980b1ee75cafbb7930f79476570c /drivers/iommu/iommu.c
parent3a18404cd952ae529651f72a13e5d6ffee824c2e (diff)
downloadlinux-409e553deeeb08d644ed1110e0f1c97b71cb6409.tar.bz2
iommu: Checking for NULL instead of IS_ERR
The iommu_group_alloc() and iommu_group_get_for_dev() functions return error pointers, they never return NULL. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 3b1a2551a747..89dc50b9acdc 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -788,15 +788,16 @@ static struct iommu_group *iommu_group_get_for_pci_dev(struct pci_dev *pdev)
/* No shared group found, allocate new */
group = iommu_group_alloc();
- if (group) {
- /*
- * Try to allocate a default domain - needs support from the
- * IOMMU driver.
- */
- group->default_domain = __iommu_domain_alloc(pdev->dev.bus,
- IOMMU_DOMAIN_DMA);
- group->domain = group->default_domain;
- }
+ if (IS_ERR(group))
+ return NULL;
+
+ /*
+ * Try to allocate a default domain - needs support from the
+ * IOMMU driver.
+ */
+ group->default_domain = __iommu_domain_alloc(pdev->dev.bus,
+ IOMMU_DOMAIN_DMA);
+ group->domain = group->default_domain;
return group;
}
@@ -1548,8 +1549,8 @@ int iommu_request_dm_for_dev(struct device *dev)
/* Device must already be in a group before calling this function */
group = iommu_group_get_for_dev(dev);
- if (!group)
- return -EINVAL;
+ if (IS_ERR(group))
+ return PTR_ERR(group);
mutex_lock(&group->mutex);