2020-08-11 07:22:16

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH] driver core: Let dev_err_probe() use the symbolic error code

This makes the error message:

error -EIO: ...

instead of

error -5: ...

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/base/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index ac1046a382bc..33734d8831c7 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -4237,10 +4237,10 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
vaf.va = &args;

if (err != -EPROBE_DEFER) {
- dev_err(dev, "error %d: %pV", err, &vaf);
+ dev_err(dev, "error %pE: %pV", ERR_PTR(err), &vaf);
} else {
device_set_deferred_probe_reason(dev, &vaf);
- dev_dbg(dev, "error %d: %pV", err, &vaf);
+ dev_dbg(dev, "error %pE: %pV", ERR_PTR(err), &vaf);
}

va_end(args);
--
2.27.0


2020-08-11 09:47:16

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] driver core: Let dev_err_probe() use the symbolic error code

On Tue, Aug 11, 2020 at 09:20:36AM +0200, Uwe Kleine-K?nig wrote:
> This makes the error message:
>
> error -EIO: ...
>
> instead of
>
> error -5: ...

Reviewed-by: Mark Brown <[email protected]>

Having the plain text is very much nicer when reading the logs!


Attachments:
(No filename) (279.00 B)
signature.asc (499.00 B)
Download all attachments

2020-08-11 15:08:10

by Andrzej Hajda

[permalink] [raw]
Subject: Re: [PATCH] driver core: Let dev_err_probe() use the symbolic error code

Hi Uwe,

On 11.08.2020 09:20, Uwe Kleine-König wrote:
> This makes the error message:
>
> error -EIO: ...
>
> instead of
>
> error -5: ...
>
> Signed-off-by: Uwe Kleine-König <[email protected]>
> ---
> drivers/base/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index ac1046a382bc..33734d8831c7 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -4237,10 +4237,10 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
> vaf.va = &args;
>
> if (err != -EPROBE_DEFER) {
> - dev_err(dev, "error %d: %pV", err, &vaf);
> + dev_err(dev, "error %pE: %pV", ERR_PTR(err), &vaf);
> } else {
> device_set_deferred_probe_reason(dev, &vaf);
> - dev_dbg(dev, "error %d: %pV", err, &vaf);
> + dev_dbg(dev, "error %pE: %pV", ERR_PTR(err), &vaf);


Apparently I have misread docs about %pE flag. Thanks for spotting this.

Reviewed-by: Andrzej Hajda <[email protected]>

Regards
Andrzej


> }
>
> va_end(args);