diff options
author | Varun Sethi <Varun.Sethi@freescale.com> | 2014-06-24 09:57:17 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2014-07-07 04:30:02 -0400 |
commit | 3170447c1f264d51b8d1f3898bf2588588a64fdc (patch) | |
tree | 6bba057a0f26380731f7ad191faff9c9a2edfac3 | |
parent | 75f0e4615dc328e67634eccd86bc71597da9f8a3 (diff) |
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>
-rw-r--r-- | drivers/iommu/fsl_pamu_domain.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index 54060d16dec8..af47648301a9 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c | |||
@@ -1037,12 +1037,15 @@ root_bus: | |||
1037 | group = get_shared_pci_device_group(pdev); | 1037 | group = get_shared_pci_device_group(pdev); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | if (!group) | ||
1041 | group = ERR_PTR(-ENODEV); | ||
1042 | |||
1040 | return group; | 1043 | return group; |
1041 | } | 1044 | } |
1042 | 1045 | ||
1043 | static int fsl_pamu_add_device(struct device *dev) | 1046 | static int fsl_pamu_add_device(struct device *dev) |
1044 | { | 1047 | { |
1045 | struct iommu_group *group = NULL; | 1048 | struct iommu_group *group = ERR_PTR(-ENODEV); |
1046 | struct pci_dev *pdev; | 1049 | struct pci_dev *pdev; |
1047 | const u32 *prop; | 1050 | const u32 *prop; |
1048 | int ret, len; | 1051 | int ret, len; |
@@ -1065,7 +1068,7 @@ static int fsl_pamu_add_device(struct device *dev) | |||
1065 | group = get_device_iommu_group(dev); | 1068 | group = get_device_iommu_group(dev); |
1066 | } | 1069 | } |
1067 | 1070 | ||
1068 | if (!group || IS_ERR(group)) | 1071 | if (IS_ERR(group)) |
1069 | return PTR_ERR(group); | 1072 | return PTR_ERR(group); |
1070 | 1073 | ||
1071 | ret = iommu_group_add_device(group, dev); | 1074 | ret = iommu_group_add_device(group, dev); |