iommu/arm-smmu: Add missing pm_runtime_disable() in qcom_iommu_device_probe
authorMiaoqian Lin <linmq006@gmail.com>
Wed, 5 Jan 2022 10:16:19 +0000 (10:16 +0000)
committerWill Deacon <will@kernel.org>
Tue, 8 Feb 2022 15:56:07 +0000 (15:56 +0000)
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().
Add missing pm_runtime_disable() for error handling.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220105101619.29108-1-linmq006@gmail.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/arm/arm-smmu/qcom_iommu.c

index b91874cb6cf335e9a877b2b49091c4a717fb6b0e..2f227bc88bd9fd74d266bd6fce5275094adc9a64 100644 (file)
@@ -827,20 +827,20 @@ static int qcom_iommu_device_probe(struct platform_device *pdev)
        ret = devm_of_platform_populate(dev);
        if (ret) {
                dev_err(dev, "Failed to populate iommu contexts\n");
-               return ret;
+               goto err_pm_disable;
        }
 
        ret = iommu_device_sysfs_add(&qcom_iommu->iommu, dev, NULL,
                                     dev_name(dev));
        if (ret) {
                dev_err(dev, "Failed to register iommu in sysfs\n");
-               return ret;
+               goto err_pm_disable;
        }
 
        ret = iommu_device_register(&qcom_iommu->iommu, &qcom_iommu_ops, dev);
        if (ret) {
                dev_err(dev, "Failed to register iommu\n");
-               return ret;
+               goto err_pm_disable;
        }
 
        bus_set_iommu(&platform_bus_type, &qcom_iommu_ops);
@@ -852,6 +852,10 @@ static int qcom_iommu_device_probe(struct platform_device *pdev)
        }
 
        return 0;
+
+err_pm_disable:
+       pm_runtime_disable(dev);
+       return ret;
 }
 
 static int qcom_iommu_device_remove(struct platform_device *pdev)