linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Zhu Yanjun <yanjun.zhu@linux.dev>
Cc: kexec@lists.infradead.org, linux-mm@kvack.org, graf@amazon.com,
	 rppt@kernel.org, changyuanl@google.com,
	akpm@linux-foundation.org,  bhe@redhat.com
Subject: Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
Date: Sat, 1 Nov 2025 09:49:46 -0400	[thread overview]
Message-ID: <CA+CK2bCHCw=5MaOVpm4VzJ0rHtuTVJ5JWECZQxc128djt3i0XA@mail.gmail.com> (raw)
In-Reply-To: <20251016200320.4179702-1-yanjun.zhu@linux.dev>

On Thu, Oct 16, 2025 at 4:03 PM Zhu Yanjun <yanjun.zhu@linux.dev> wrote:
>
> Make pr_xxx() call to use the %pe format specifier instead of %d.
> The %pe specifier prints a symbolic error string (e.g., -ENOMEM,
> -EINVAL) when given an error pointer created with ERR_PTR(err).
>
> This change enhances the clarity and diagnostic value of the error
> message by showing a descriptive error name rather than a numeric
> error code.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> CC: graf@amazon.com
> CC: rppt@kernel.org
> CC: changyuanl@google.com
> CC: akpm@linux-foundation.org
> CC: bhe@redhat.com
>
> ---
>  kernel/kexec_handover.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/kernel/kexec_handover.c b/kernel/kexec_handover.c
> index 76f0940fb485..77af377022b0 100644
> --- a/kernel/kexec_handover.c
> +++ b/kernel/kexec_handover.c
> @@ -1095,7 +1095,7 @@ static int kho_abort(void)
>         err = notifier_to_errno(err);
>
>         if (err)
> -               pr_err("Failed to abort KHO finalization: %d\n", err);
> +               pr_err("Failed to abort KHO finalization: %pe\n", ERR_PTR(err));
>
>         return err;
>  }
> @@ -1142,7 +1142,7 @@ static int kho_finalize(void)
>
>  abort:
>         if (err) {
> -               pr_err("Failed to convert KHO state tree: %d\n", err);
> +               pr_err("Failed to convert KHO state tree: %pe\n", ERR_PTR(err));

The problem here (and in some other places below) is err a not an
-errno, but fdt error:
see: scripts/dtc/libfdt/libfdt.h

%pe ERR_PTR(err)  will output garbage, and make the debugging even harder.


      parent reply	other threads:[~2025-11-01 13:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16 20:03 Zhu Yanjun
2025-10-21  9:41 ` Simon Horman
2025-10-21 13:56   ` Zhu Yanjun
2025-10-21 22:42   ` yanjun.zhu
2025-10-31 20:09   ` Yanjun.Zhu
2025-10-31 20:18     ` Pasha Tatashin
2025-10-31 21:00       ` Yanjun.Zhu
2025-11-01 13:49 ` Pasha Tatashin [this message]

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='CA+CK2bCHCw=5MaOVpm4VzJ0rHtuTVJ5JWECZQxc128djt3i0XA@mail.gmail.com' \
    --to=pasha.tatashin@soleen.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=changyuanl@google.com \
    --cc=graf@amazon.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    --cc=yanjun.zhu@linux.dev \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox