[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1dde296b-045e-d56a-1734-a1333a84060b@linux.intel.com>
Date: Wed, 21 Aug 2024 15:38:15 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Hans de Goede <hdegoede@...hat.com>, LKML <linux-kernel@...r.kernel.org>,
platform-driver-x86@...r.kernel.org,
"Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Scally <djrscally@...il.com>
Subject: Re: [PATCH v1 1/4] driver core: Ignore 0 in dev_err_probe()
On Wed, 21 Aug 2024, Andy Shevchenko wrote:
> In the similar way, ignore 0 error code (AKA "success") in
> dev_err_probe(). This helps to simplify a code such as
>
> if (ret < 0)
> return dev_err_probe(int3472->dev, ret, err_msg);
>
> return ret;
>
> to
>
> return dev_err_probe(int3472->dev, ret, err_msg);
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> drivers/base/core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 6d3897492285..144cb8c201fb 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -5046,6 +5046,10 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
> */
> break;
>
> + case 0:
> + /* Success, no need to issue an error message */
> + break;
> +
> default:
> dev_err(dev, "error %pe: %pV", ERR_PTR(err), &vaf);
> break;
>
This seems generally useful,
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
A nit, the code sequence that dev_err_probe() is documented to replace is
no longer matches with the behavior (the else would need if (err < 0)
added).
--
i.
Powered by blists - more mailing lists