Skip to content

Commit

Permalink
iommu/fsl: Fix the error condition during iommu group
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Varun Sethi authored and Joerg Roedel committed Jul 7, 2014
1 parent 75f0e46 commit 3170447
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/iommu/fsl_pamu_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 3170447

Please sign in to comment.