mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iommu/rockchip: Fix silent probe success when all MMU resources fail
@ 2026-07-23 13:26 ZhaoJinming
  2026-07-26 15:00 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: ZhaoJinming @ 2026-07-23 13:26 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon
  Cc: Robin Murphy, Heiko Stuebner, iommu, linux-arm-kernel,
	linux-rockchip, linux-kernel, ZhaoJinming

When all MMU register mappings fail in rk_iommu_probe(), the error
path returns PTR_ERR(iommu->bases[0]). However, bases[0] can be NULL
if the first platform_get_resource() also returned NULL, causing
PTR_ERR(NULL) to evaluate to 0 and the probe to succeed silently.

Return -ENODEV directly instead.

Signed-off-by: ZhaoJinming <zhaojinming@uniontech.com>
---
drivers/iommu/rockchip-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 87ae036d6414..32868ea5fa03 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1245,7 +1245,7 @@ static int rk_iommu_probe(struct platform_device *pdev)
 		iommu->num_mmu++;
 	}
 	if (iommu->num_mmu == 0)
-		return PTR_ERR(iommu->bases[0]);
+		return -ENODEV;
 
 	iommu->num_irq = platform_irq_count(pdev);
 	if (iommu->num_irq < 0)
-- 
2.20.1

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

* Re: [PATCH] iommu/rockchip: Fix silent probe success when all MMU resources fail
  2026-07-23 13:26 [PATCH] iommu/rockchip: Fix silent probe success when all MMU resources fail ZhaoJinming
@ 2026-07-26 15:00 ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2026-07-26 15:00 UTC (permalink / raw)
  To: Joerg Roedel, ZhaoJinming
  Cc: catalin.marinas, kernel-team, Will Deacon, Robin Murphy,
	Heiko Stuebner, iommu, linux-arm-kernel, linux-rockchip,
	linux-kernel

On Thu, 23 Jul 2026 21:26:43 +0800, ZhaoJinming wrote:
> When all MMU register mappings fail in rk_iommu_probe(), the error
> path returns PTR_ERR(iommu->bases[0]). However, bases[0] can be NULL
> if the first platform_get_resource() also returned NULL, causing
> PTR_ERR(NULL) to evaluate to 0 and the probe to succeed silently.
> 
> Return -ENODEV directly instead.
> 
> [...]

Applied to iommu (rockchip), thanks!

[1/1] iommu/rockchip: Fix silent probe success when all MMU resources fail
      https://git.kernel.org/iommu/c/ea0a9d453f60

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

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

end of thread, other threads:[~2026-07-26 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-23 13:26 [PATCH] iommu/rockchip: Fix silent probe success when all MMU resources fail ZhaoJinming
2026-07-26 15:00 ` Will Deacon

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

all inboxes | Powered by JetHome®