aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/fsl_pamu_domain.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu/fsl_pamu_domain.c')
-rw-r--r--drivers/iommu/fsl_pamu_domain.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index 61d1dafa242d..56feed7cec15 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -984,7 +984,7 @@ static int fsl_pamu_add_device(struct device *dev)
984 struct iommu_group *group = ERR_PTR(-ENODEV); 984 struct iommu_group *group = ERR_PTR(-ENODEV);
985 struct pci_dev *pdev; 985 struct pci_dev *pdev;
986 const u32 *prop; 986 const u32 *prop;
987 int ret, len; 987 int ret = 0, len;
988 988
989 /* 989 /*
990 * For platform devices we allocate a separate group for 990 * For platform devices we allocate a separate group for
@@ -1007,7 +1007,13 @@ static int fsl_pamu_add_device(struct device *dev)
1007 if (IS_ERR(group)) 1007 if (IS_ERR(group))
1008 return PTR_ERR(group); 1008 return PTR_ERR(group);
1009 1009
1010 ret = iommu_group_add_device(group, dev); 1010 /*
1011 * Check if device has already been added to an iommu group.
1012 * Group could have already been created for a PCI device in
1013 * the iommu_group_get_for_dev path.
1014 */
1015 if (!dev->iommu_group)
1016 ret = iommu_group_add_device(group, dev);
1011 1017
1012 iommu_group_put(group); 1018 iommu_group_put(group);
1013 return ret; 1019 return ret;