linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Rix <trix@redhat.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Andrzej Hajda" <a.hajda@samsung.com>,
	"Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Mark Brown" <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver code: print symbolic error code
Date: Fri, 28 Aug 2020 11:22:25 -0700	[thread overview]
Message-ID: <434ca0ab-1c9b-5c4f-c844-5e792725f9ab@redhat.com> (raw)
In-Reply-To: <ea3f973e4708919573026fdce52c264db147626d.1598630856.git.mirq-linux@rere.qmqm.pl>


On 8/28/20 9:14 AM, Michał Mirosław wrote:
> dev_err_probe() prepends the message with an error code. Let's make it
> more readable by translating the code to a more recognisable symbol.
recognizable
>
> Fixes: a787e5400a1c ("driver core: add device probe log helper")
is this change really to fix a bug?
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  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..1a4706310b28 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);

Should just use '-EPROBE_DEFER' directly instead of making printk do it.

or maybe reduce the original if-else to an just an if

if (err == -EPROBE_DEFER)

    device_set_deferred_probe_reason(...

dev_dbg(dev, "error %pe ...

Tom

>  	}
>  
>  	va_end(args);


  reply	other threads:[~2020-08-28 18:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28 16:14 Michał Mirosław
2020-08-28 18:22 ` Tom Rix [this message]
2020-08-29 10:43   ` Michał Mirosław

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=434ca0ab-1c9b-5c4f-c844-5e792725f9ab@redhat.com \
    --to=trix@redhat.com \
    --cc=a.hajda@samsung.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=rafael@kernel.org \
    --subject='Re: [PATCH] driver code: print symbolic error code' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).