[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWX7rC2zswHoo6aFf3CYp3NKAfJ7E0x4W2wbVkybGa84g@mail.gmail.com>
Date: Mon, 17 May 2021 09:04:15 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Zhen Lei <thunder.leizhen@...wei.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Vladimir Oltean <vladimir.oltean@....com>
Subject: Re: [PATCH 1/1] lib: devres: Add error information printing for __devm_ioremap_resource()
Hi Zhen,
On Wed, Apr 28, 2021 at 8:33 AM Zhen Lei <thunder.leizhen@...wei.com> wrote:
> Ensure that all error handling branches print error information. In this
> way, when this function fails, the upper-layer functions can directly
> return an error code without missing debugging information. Otherwise,
> the error message will be printed redundantly or missing.
>
> Fixes: 35bd8c07db2c ("devres: keep both device name and resource name in pretty name")
> Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
Thanks for your patch, which is now commit 5c3e241f5246445d ("lib:
devres: Add error information printing for __devm_ioremap_resource()")
in driver-core-next.
> --- a/lib/devres.c
> +++ b/lib/devres.c
> @@ -157,8 +157,10 @@ __devm_ioremap_resource(struct device *dev, const struct resource *res,
> dev_name(dev), res->name);
> else
> pretty_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL);
> - if (!pretty_name)
> + if (!pretty_name) {
> + dev_err(dev, "can't generate pretty name for resource %pR\n", res);
If the above fails, it is due to a memory allocation failure, and the
memory allocation core will have already printed an error message.
So there is no need to print a second message.
Hence IMHO this commit should be reverted.
> return IOMEM_ERR_PTR(-ENOMEM);
> + }
>
> if (!devm_request_mem_region(dev, res->start, size, pretty_name)) {
> dev_err(dev, "can't request region for resource %pR\n", res);
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists