[PATCH] iommu/qcom: Remove sysfs device on probe failure path

Mukesh Ojha mukesh.ojha at oss.qualcomm.com
Tue Jun 23 01:51:50 PDT 2026


On Tue, Jun 23, 2026 at 03:12:45PM +0800, Haoxiang Li wrote:
> In qcom_iommu_device_probe(), if iommu_device_register()

You can take space till col 65..

> fails, the sysfs device created by iommu_device_sysfs_add()
> is not released. Add a goto label to do the cleanup.
> 
> Fixes: 0ae349a0f33f ("iommu/qcom: Add qcom_iommu")
> Signed-off-by: Haoxiang Li <haoxiang_li2024 at 163.com>

Not related to this change,  but there are some more issue in this
driver..

Reviewed-by: Mukesh Ojha <mukesh.ojha at oss.qualcomm.com>

> ---
>  drivers/iommu/arm/arm-smmu/qcom_iommu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> index a1e8cf29f594..32efef69e72d 100644
> --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> @@ -855,7 +855,7 @@ static int qcom_iommu_device_probe(struct platform_device *pdev)
>  	ret = iommu_device_register(&qcom_iommu->iommu, &qcom_iommu_ops, dev);
>  	if (ret) {
>  		dev_err(dev, "Failed to register iommu\n");
> -		goto err_pm_disable;
> +		goto err_sysfs_remove;
>  	}
>  
>  	if (qcom_iommu->local_base) {
> @@ -866,6 +866,8 @@ static int qcom_iommu_device_probe(struct platform_device *pdev)
>  
>  	return 0;
>  
> +err_sysfs_remove:
> +	iommu_device_sysfs_remove(&qcom_iommu->iommu);
>  err_pm_disable:
>  	pm_runtime_disable(dev);
>  	return ret;
> -- 
> 2.25.1
> 

-- 
-Mukesh Ojha



More information about the linux-arm-kernel mailing list