提交 3170447c 编写于 作者: V Varun Sethi 提交者: 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: NVarun Sethi <Varun.Sethi@freescale.com>
Signed-off-by: NJoerg Roedel <jroedel@suse.de>
上级 75f0e461
...@@ -1037,12 +1037,15 @@ static struct iommu_group *get_pci_device_group(struct pci_dev *pdev) ...@@ -1037,12 +1037,15 @@ static struct iommu_group *get_pci_device_group(struct pci_dev *pdev)
group = get_shared_pci_device_group(pdev); group = get_shared_pci_device_group(pdev);
} }
if (!group)
group = ERR_PTR(-ENODEV);
return group; return group;
} }
static int fsl_pamu_add_device(struct device *dev) 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; struct pci_dev *pdev;
const u32 *prop; const u32 *prop;
int ret, len; int ret, len;
...@@ -1065,7 +1068,7 @@ static int fsl_pamu_add_device(struct device *dev) ...@@ -1065,7 +1068,7 @@ static int fsl_pamu_add_device(struct device *dev)
group = get_device_iommu_group(dev); group = get_device_iommu_group(dev);
} }
if (!group || IS_ERR(group)) if (IS_ERR(group))
return PTR_ERR(group); return PTR_ERR(group);
ret = iommu_group_add_device(group, dev); ret = iommu_group_add_device(group, dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册