mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
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>
This commit is contained in:
parent
3a18404cd9
commit
409e553dee
1 changed files with 12 additions and 11 deletions
|
@ -788,15 +788,16 @@ static struct iommu_group *iommu_group_get_for_pci_dev(struct pci_dev *pdev)
|
||||||
|
|
||||||
/* No shared group found, allocate new */
|
/* No shared group found, allocate new */
|
||||||
group = iommu_group_alloc();
|
group = iommu_group_alloc();
|
||||||
if (group) {
|
if (IS_ERR(group))
|
||||||
/*
|
return NULL;
|
||||||
* Try to allocate a default domain - needs support from the
|
|
||||||
* IOMMU driver.
|
/*
|
||||||
*/
|
* Try to allocate a default domain - needs support from the
|
||||||
group->default_domain = __iommu_domain_alloc(pdev->dev.bus,
|
* IOMMU driver.
|
||||||
IOMMU_DOMAIN_DMA);
|
*/
|
||||||
group->domain = group->default_domain;
|
group->default_domain = __iommu_domain_alloc(pdev->dev.bus,
|
||||||
}
|
IOMMU_DOMAIN_DMA);
|
||||||
|
group->domain = group->default_domain;
|
||||||
|
|
||||||
return group;
|
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 */
|
/* Device must already be in a group before calling this function */
|
||||||
group = iommu_group_get_for_dev(dev);
|
group = iommu_group_get_for_dev(dev);
|
||||||
if (!group)
|
if (IS_ERR(group))
|
||||||
return -EINVAL;
|
return PTR_ERR(group);
|
||||||
|
|
||||||
mutex_lock(&group->mutex);
|
mutex_lock(&group->mutex);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue