Commit 3170447c authored by Varun Sethi's avatar Varun Sethi Committed by Joerg Roedel

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: default avatarVarun Sethi <Varun.Sethi@freescale.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 75f0e461
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment