From: Thierry Reding <thierry.reding@gmail.com>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
jonathanh@nvidia.com
Subject: Re: [PATCH -next] soc/tegra: fuse: add missing iounmap() on error in tegra_init_fuse()
Date: Fri, 9 Apr 2021 13:32:34 +0200 [thread overview]
Message-ID: <YHA7UtJ4o1BNHc1K@orome.fritz.box> (raw)
In-Reply-To: <20210409044903.663632-1-yangyingliang@huawei.com>
[-- 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 --]
prev parent reply other threads:[~2021-04-09 11:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 4:49 Yang Yingliang
2021-04-09 11:32 ` Thierry Reding [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YHA7UtJ4o1BNHc1K@orome.fritz.box \
--to=thierry.reding@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=yangyingliang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®