From: Thierry Reding <thierry.reding@gmail.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Qilong Zhang <zhangqilong3@huawei.com>,
mturquette@baylibre.com, pdeschrijver@nvidia.com,
pgaikwad@nvidia.com, jonathanh@nvidia.com,
linux-clk@vger.kernel.org
Subject: Re: [PATCH -next] clk: tegra: clk-dfll: indicate correct error reason in tegra_dfll_register
Date: Thu, 24 Sep 2020 09:17:06 +0200 [thread overview]
Message-ID: <20200924071706.GB2480300@ulmo> (raw)
In-Reply-To: <160090396030.310579.9633354457476529250@swboyd.mtv.corp.google.com>
[-- Attachment #1: Type: text/plain, Size: 2027 bytes --]
On Wed, Sep 23, 2020 at 04:32:40PM -0700, Stephen Boyd wrote:
> Quoting Thierry Reding (2020-09-23 01:16:54)
> > On Tue, Sep 22, 2020 at 12:57:46PM -0700, Stephen Boyd wrote:
> > > Quoting Qilong Zhang (2020-09-18 02:46:42)
> > > > From: Zhang Qilong <zhangqilong3@huawei.com>
> > > >
> > > > Calling devm_ioremap means getting devices resource have been
> > > > successful. When remap operation failed, we should return '-ENOMEM'
> > > > instead of '-ENODEV' to differentiate between getting resource and
> > > > mapping memory for reminding callers. Moreover, it is not consistent
> > > > with devm_kzalloc operation.
> > > >
> > > > Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> > > > ---
> > > > drivers/clk/tegra/clk-dfll.c | 8 ++++----
> > > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c
> > > > index cfbaa90c7adb..6637b73be9f1 100644
> > > > --- a/drivers/clk/tegra/clk-dfll.c
> > > > +++ b/drivers/clk/tegra/clk-dfll.c
> > > > @@ -1993,7 +1993,7 @@ int tegra_dfll_register(struct platform_device *pdev,
> > > > td->base = devm_ioremap(td->dev, mem->start, resource_size(mem));
> > > > if (!td->base) {
> > > > dev_err(td->dev, "couldn't ioremap DFLL control registers\n");
> > > > - return -ENODEV;
> > > > + return -ENOMEM;
> > >
> > > Can you remove the dev_err() lines too? They're pretty much useless.
> >
> > I find them somewhat useful because they indicate which particular
> > resource wasn't properly mapped. If we get an -ENOMEM without the error
> > message, we'll have to go and guess which one it is.
> >
>
> Doesn't that print the stacktrace when we run out of memory?
slab allocator functions like kmalloc() and friends do, but I'm not
aware of ioremap() doing so. Perhaps if it runs out of virtual memory
for the mapping it would, but there are other reasons why this can fail.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-09-24 7:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 9:46 [PATCH -next] clk: tegra: clk-dfll: indicate correct error reason in tegra_dfll_register Qilong Zhang
2020-09-22 19:57 ` Stephen Boyd
2020-09-23 8:16 ` Thierry Reding
2020-09-23 23:32 ` Stephen Boyd
2020-09-24 7:17 ` Thierry Reding [this message]
2020-10-08 2:08 ` Stephen Boyd
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=20200924071706.GB2480300@ulmo \
--to=thierry.reding@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-clk@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=pdeschrijver@nvidia.com \
--cc=pgaikwad@nvidia.com \
--cc=sboyd@kernel.org \
--cc=zhangqilong3@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