[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YUQ1HW0P9e0ENGRE@kroah.com>
Date: Fri, 17 Sep 2021 08:26:37 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Douglas Anderson <dianders@...omium.org>
Cc: rafael@...nel.org, broonie@...nel.org, andy.shevchenko@...il.com,
a.hajda@...sung.com, Stephen Boyd <swboyd@...omium.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] driver core: Clarify that dev_err_probe() is OK even
w/out -EPROBE_DEFER
On Thu, Sep 16, 2021 at 04:19:40PM -0700, Douglas Anderson wrote:
> There is some debate about whether it's deemed acceptable to call
> dev_err_probe() if you know that the error code can never be
> -EPROBE_DEFER. Clarify in the function comments that this is
> OK. Specifically this makes us able to transform code like this:
>
> ret = do_something_that_cant_defer();
> if (ret < 0) {
> dev_err(dev, "The foo failed to bar (%pe)\n", ERR_PTR(ret));
> return ret;
> }
>
> to code like this:
> ret = do_something_that_cant_defer();
> if (ret < 0)
> return dev_err_probe(dev, ret, "The foo failed to bar\n");
>
> It is also possible that in the future folks might want a CONFIG
> option to strip out all probe error strings to save space (keeping
> non-probe errors) with the argument that probe errors rarely happen
> after bringup. Having probe errors reported with a consistent function
> would allow that.
>
> Cc: Stephen Boyd <swboyd@...omium.org>
> Signed-off-by: Douglas Anderson <dianders@...omium.org>
> ---
>
> drivers/base/core.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index e65dd803a453..85b8955717fc 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -4653,6 +4653,11 @@ define_dev_printk_level(_dev_info, KERN_INFO);
> *
> * return dev_err_probe(dev, err, ...);
> *
> + * Note that it is deemed acceptable to use this function for error
> + * prints during probe even if the @err is known to never be -EPROBE_DEFER.
> + * The benefit compared to a normal dev_err() is the standardized format
> + * of the error code and the fact that the error code is returned.
> + *
> * Returns @err.
> *
> */
> --
> 2.33.0.464.g1972c5931b-goog
>
Nice, no objection from me, I'll go queue this up.
greg k-h
Powered by blists - more mailing lists