From e910315ae08a23bc953daed10b1c518abac1df49 Mon Sep 17 00:00:00 2001 From: Mukesh Ojha Date: Fri, 17 Jul 2026 20:16:05 +0530 Subject: [PATCH] iommu/qcom: Check pm_runtime_resume_and_get() return in probe The SMMU_INTR_SEL_NS register write in qcom_iommu_device_probe() uses pm_runtime_get_sync() without checking the return value. If runtime resume fails the subsequent writel_relaxed() would access hardware with clocks potentially disabled. Switch to pm_runtime_resume_and_get() which handles the usage-count cleanup on failure, check the return value, and unwind the already registered iommu device on error. Reviewed-by: Konrad Dybcio Signed-off-by: Mukesh Ojha Signed-off-by: Will Deacon --- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c index 71251aecc292..1d04f0a19124 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -861,13 +861,17 @@ static int qcom_iommu_device_probe(struct platform_device *pdev) } if (qcom_iommu->local_base) { - pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret) + goto err_iommu_unregister; writel_relaxed(0xffffffff, qcom_iommu->local_base + SMMU_INTR_SEL_NS); pm_runtime_put_sync(dev); } return 0; +err_iommu_unregister: + iommu_device_unregister(&qcom_iommu->iommu); err_sysfs_remove: iommu_device_sysfs_remove(&qcom_iommu->iommu); return ret;