* [PATCH next] iommu/tegra241-cmdqv: Fix ioremap() error handling in probe()
@ 2024-09-04 8:02 Dan Carpenter
2024-09-04 14:50 ` Nicolin Chen
2024-09-04 16:12 ` Will Deacon
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-09-04 8:02 UTC (permalink / raw)
To: Nate Watterson
Cc: Thierry Reding, Krishna Reddy, Will Deacon, Robin Murphy,
Joerg Roedel, Jonathan Hunter, Nicolin Chen, Jason Gunthorpe,
linux-tegra, linux-arm-kernel, iommu, linux-kernel,
kernel-janitors
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@linaro.org>
---
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 03fd13c21dcc..240b54192177 100644
--- a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
+++ b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
@@ -772,9 +772,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.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH next] iommu/tegra241-cmdqv: Fix ioremap() error handling in probe()
2024-09-04 8:02 [PATCH next] iommu/tegra241-cmdqv: Fix ioremap() error handling in probe() Dan Carpenter
@ 2024-09-04 14:50 ` Nicolin Chen
2024-09-04 16:12 ` Will Deacon
1 sibling, 0 replies; 3+ messages in thread
From: Nicolin Chen @ 2024-09-04 14:50 UTC (permalink / raw)
To: Dan Carpenter
Cc: Nate Watterson, Thierry Reding, Krishna Reddy, Will Deacon,
Robin Murphy, Joerg Roedel, Jonathan Hunter, Jason Gunthorpe,
linux-tegra, linux-arm-kernel, iommu, linux-kernel,
kernel-janitors
On Wed, Sep 04, 2024 at 11:02:43AM +0300, Dan Carpenter wrote:
> 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@linaro.org>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH next] iommu/tegra241-cmdqv: Fix ioremap() error handling in probe()
2024-09-04 8:02 [PATCH next] iommu/tegra241-cmdqv: Fix ioremap() error handling in probe() Dan Carpenter
2024-09-04 14:50 ` Nicolin Chen
@ 2024-09-04 16:12 ` Will Deacon
1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2024-09-04 16:12 UTC (permalink / raw)
To: Nate Watterson, Dan Carpenter
Cc: catalin.marinas, kernel-team, Will Deacon, Thierry Reding,
Krishna Reddy, Robin Murphy, Joerg Roedel, Jonathan Hunter,
Nicolin Chen, Jason Gunthorpe, linux-tegra, linux-arm-kernel,
iommu, linux-kernel, kernel-janitors
On Wed, 04 Sep 2024 11:02:43 +0300, Dan Carpenter wrote:
> 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.
>
>
> [...]
Applied to will (for-joerg/arm-smmu/updates), thanks!
[1/1] iommu/tegra241-cmdqv: Fix ioremap() error handling in probe()
https://git.kernel.org/will/c/086a3c40ebd0
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-04 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 8:02 [PATCH next] iommu/tegra241-cmdqv: Fix ioremap() error handling in probe() Dan Carpenter
2024-09-04 14:50 ` Nicolin Chen
2024-09-04 16:12 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).