[SRU][N:linux-azure-nvidia][PATCH 1/4] iommu/tegra241-cmdqv: Fix ioremap() error handling in probe()
John Cabaj
john.cabaj at canonical.com
Tue Feb 25 21:20:27 UTC 2025
From: Dan Carpenter <dan.carpenter at linaro.org>
BugLink: https://bugs.launchpad.net/bugs/2100199
The ioremap() function doesn't return error pointers, it returns NULL
on error so update the error handling. Also just return directly
instead of calling iounmap() on the NULL pointer. Calling
iounmap(NULL) doesn't cause a problem on ARM but on other architectures
it can trigger a warning so it'a bad habbit.
Fixes: 918eb5c856f6 ("iommu/arm-smmu-v3: Add in-kernel support for NVIDIA Tegra241 (Grace) CMDQV")
Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
Reviewed-by: Nicolin Chen <nicolinc at nvidia.com>
Link: https://lore.kernel.org/r/5a6c1e9a-0724-41b1-86d4-36335d3768ea@stanley.mountain
Signed-off-by: Will Deacon <will at kernel.org>
(cherry picked from commit 086a3c40ebd02a4ac38121cf909326407b2883bc)
Signed-off-by: John Cabaj <john.cabaj at canonical.com>
---
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
index aafeb977ed46..c8283de643ea 100644
--- a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
+++ b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
@@ -775,9 +775,9 @@ __tegra241_cmdqv_probe(struct arm_smmu_device *smmu, struct resource *res,
static_assert(offsetof(struct tegra241_cmdqv, smmu) == 0);
base = ioremap(res->start, resource_size(res));
- if (IS_ERR(base)) {
- dev_err(smmu->dev, "failed to ioremap: %ld\n", PTR_ERR(base));
- goto iounmap;
+ if (!base) {
+ dev_err(smmu->dev, "failed to ioremap\n");
+ return NULL;
}
regval = readl(base + TEGRA241_CMDQV_CONFIG);
--
2.43.0
More information about the kernel-team
mailing list