[PATCH] iommu: arm-smmu: Handle return of iommu_device_register.

From: Arvind Yadav
Date: Thu Jun 22 2017 - 03:29:46 EST


iommu_device_register can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
---
drivers/iommu/arm-smmu-v3.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 7d3f08a..182eb38 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2736,6 +2736,8 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
iommu_device_set_fwnode(&smmu->iommu, dev->fwnode);

ret = iommu_device_register(&smmu->iommu);
+ if (ret)
+ return ret;

#ifdef CONFIG_PCI
if (pci_bus_type.iommu_ops != &arm_smmu_ops) {
--
1.9.1