Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/qcom: Remove sysfs device on probe failure path
@ 2026-06-23  7:12 Haoxiang Li
  2026-06-23  8:51 ` Mukesh Ojha
  2026-06-23  9:40 ` Konrad Dybcio
  0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2026-06-23  7:12 UTC (permalink / raw)
  To: robin.clark, will, robin.murphy, joro, jroedel
  Cc: iommu, linux-arm-msm, linux-arm-kernel, linux-kernel, Haoxiang Li

In qcom_iommu_device_probe(), if iommu_device_register()
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@163.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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu/qcom: Remove sysfs device on probe failure path
  2026-06-23  7:12 [PATCH] iommu/qcom: Remove sysfs device on probe failure path Haoxiang Li
@ 2026-06-23  8:51 ` Mukesh Ojha
  2026-06-23  9:40 ` Konrad Dybcio
  1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Ojha @ 2026-06-23  8:51 UTC (permalink / raw)
  To: Haoxiang Li
  Cc: robin.clark, will, robin.murphy, joro, jroedel, iommu,
	linux-arm-msm, linux-arm-kernel, linux-kernel

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@163.com>

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

Reviewed-by: Mukesh Ojha <mukesh.ojha@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu/qcom: Remove sysfs device on probe failure path
  2026-06-23  7:12 [PATCH] iommu/qcom: Remove sysfs device on probe failure path Haoxiang Li
  2026-06-23  8:51 ` Mukesh Ojha
@ 2026-06-23  9:40 ` Konrad Dybcio
  1 sibling, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2026-06-23  9:40 UTC (permalink / raw)
  To: Haoxiang Li, robin.clark, will, robin.murphy, joro, jroedel
  Cc: iommu, linux-arm-msm, linux-arm-kernel, linux-kernel

On 6/23/26 9:12 AM, Haoxiang Li wrote:
> In qcom_iommu_device_probe(), if iommu_device_register()
> 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@163.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-23  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23  7:12 [PATCH] iommu/qcom: Remove sysfs device on probe failure path Haoxiang Li
2026-06-23  8:51 ` Mukesh Ojha
2026-06-23  9:40 ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox