iommu: arm-smmu: Handle return of iommu_device_register.
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Thu, 22 Jun 2017 07:27:42 +0000 (12:57 +0530)
committerWill Deacon <will.deacon@arm.com>
Fri, 23 Jun 2017 16:57:58 +0000 (17:57 +0100)
iommu_device_register returns an error code and, although it currently
never fails, we should check its return value anyway.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
[will: adjusted to follow arm-smmu.c]
Signed-off-by: Will Deacon <will.deacon@arm.com>
drivers/iommu/arm-smmu-v3.c

index 0fd09745822f5cbef0b9d717917067e6ff3c9cf1..029fe0cffee7631a5cb495c18b0e089b966f527b 100644 (file)
@@ -2744,6 +2744,10 @@ 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) {
+               dev_err(dev, "Failed to register iommu\n");
+               return ret;
+       }
 
 #ifdef CONFIG_PCI
        if (pci_bus_type.iommu_ops != &arm_smmu_ops) {