iommu/fsl: Fix the error condition during iommu group
Earlier PTR_ERR was being returned even if group was set to null. Now, we explicitly set an ERR_PTR value in case the group pointer is NULL. Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
75f0e4615d
commit
3170447c1f
1 changed files with 5 additions and 2 deletions
|
@ -1037,12 +1037,15 @@ static struct iommu_group *get_pci_device_group(struct pci_dev *pdev)
|
|||
group = get_shared_pci_device_group(pdev);
|
||||
}
|
||||
|
||||
if (!group)
|
||||
group = ERR_PTR(-ENODEV);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
static int fsl_pamu_add_device(struct device *dev)
|
||||
{
|
||||
struct iommu_group *group = NULL;
|
||||
struct iommu_group *group = ERR_PTR(-ENODEV);
|
||||
struct pci_dev *pdev;
|
||||
const u32 *prop;
|
||||
int ret, len;
|
||||
|
@ -1065,7 +1068,7 @@ static int fsl_pamu_add_device(struct device *dev)
|
|||
group = get_device_iommu_group(dev);
|
||||
}
|
||||
|
||||
if (!group || IS_ERR(group))
|
||||
if (IS_ERR(group))
|
||||
return PTR_ERR(group);
|
||||
|
||||
ret = iommu_group_add_device(group, dev);
|
||||
|
|
Loading…
Reference in a new issue