[PATCH] iommu/rockchip: Fix silent probe success when all MMU resources fail
ZhaoJinming <[email protected]>
| Newsgroups | dev.linux.lists.iommu,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-rockchip,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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