* [PATCH -next] soc/tegra: fuse: add missing iounmap() on error in tegra_init_fuse()
@ 2021-04-09 4:49 Yang Yingliang
2021-04-09 11:32 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-04-09 4:49 UTC (permalink / raw)
To: linux-kernel, linux-tegra; +Cc: jonathanh, thierry.reding
Add the missing iounmap() before return from tegra_init_fuse()
in the error handling case.
Fixes: 9f94fadd75d3 ("soc/tegra: fuse: Register cell lookups for compatibility")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/soc/tegra/fuse/fuse-tegra.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 94b60a692b51..bc8d70e6a676 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -489,8 +489,10 @@ static int __init tegra_init_fuse(void)
size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups;
fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
- if (!fuse->lookups)
+ if (!fuse->lookups) {
+ iounmap(fuse->base);
return -ENOMEM;
+ }
nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH -next] soc/tegra: fuse: add missing iounmap() on error in tegra_init_fuse()
2021-04-09 4:49 [PATCH -next] soc/tegra: fuse: add missing iounmap() on error in tegra_init_fuse() Yang Yingliang
@ 2021-04-09 11:32 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2021-04-09 11:32 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, linux-tegra, jonathanh
[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]
On Fri, Apr 09, 2021 at 12:49:03PM +0800, Yang Yingliang wrote:
> Add the missing iounmap() before return from tegra_init_fuse()
> in the error handling case.
>
> Fixes: 9f94fadd75d3 ("soc/tegra: fuse: Register cell lookups for compatibility")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/soc/tegra/fuse/fuse-tegra.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
> index 94b60a692b51..bc8d70e6a676 100644
> --- a/drivers/soc/tegra/fuse/fuse-tegra.c
> +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
> @@ -489,8 +489,10 @@ static int __init tegra_init_fuse(void)
> size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups;
>
> fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
> - if (!fuse->lookups)
> + if (!fuse->lookups) {
> + iounmap(fuse->base);
> return -ENOMEM;
> + }
>
> nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
> }
I don't think that's a good idea. Given that this is an early_initcall,
the failure doesn't actually prevent the driver from loading. There are
other functions that rely on fuse->base staying around to access some of
the registers in that I/O memory region.
I suppose we could remove the -ENOMEM return there and instead just skip
registering the nvmem cell lookups, perhaps that would make this less
confusing.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-09 11:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 4:49 [PATCH -next] soc/tegra: fuse: add missing iounmap() on error in tegra_init_fuse() Yang Yingliang
2021-04-09 11:32 ` Thierry Reding
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®