All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: kexec@lists.infradead.org, linux-mm@kvack.org
Cc: Zhu Yanjun <yanjun.zhu@linux.dev>,
	graf@amazon.com, rppt@kernel.org, changyuanl@google.com,
	akpm@linux-foundation.org, bhe@redhat.com
Subject: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
Date: Thu, 16 Oct 2025 20:03:20 +0000	[thread overview]
Message-ID: <20251016200320.4179702-1-yanjun.zhu@linux.dev> (raw)

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));
 		kho_abort();
 	}
 
@@ -1355,8 +1355,8 @@ static __init int kho_in_debugfs_init(const void *fdt)
 		err = kho_debugfs_fdt_add(&kho_in.fdt_list, sub_fdt_dir, name,
 					  phys_to_virt(*fdt_phys));
 		if (err) {
-			pr_warn("failed to add fdt `%s` to debugfs: %d\n", name,
-				err);
+			pr_warn("failed to add fdt `%s` to debugfs: %pe\n", name,
+				ERR_PTR(err));
 			continue;
 		}
 	}
@@ -1400,8 +1400,8 @@ static __init int kho_init(void)
 		 * kexec.
 		 */
 		if (err)
-			pr_err("failed exposing handover FDT in debugfs: %d\n",
-			       err);
+			pr_err("failed exposing handover FDT in debugfs: %pe\n",
+			       ERR_PTR(err));
 
 		return 0;
 	}
@@ -1524,8 +1524,8 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
 		memblock_add(area->addr, size);
 		err = memblock_mark_kho_scratch(area->addr, size);
 		if (WARN_ON(err)) {
-			pr_warn("failed to mark the scratch region 0x%pa+0x%pa: %d",
-				&area->addr, &size, err);
+			pr_warn("failed to mark the scratch region 0x%pa+0x%pa: %pe",
+				&area->addr, &size, ERR_PTR(err));
 			goto out;
 		}
 		pr_debug("Marked 0x%pa+0x%pa as scratch", &area->addr, &size);
@@ -1553,7 +1553,7 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
 	if (scratch)
 		early_memunmap(scratch, scratch_len);
 	if (err)
-		pr_warn("disabling KHO revival: %d\n", err);
+		pr_warn("disabling KHO revival: %pe\n", ERR_PTR(err));
 }
 
 /* Helper functions for kexec_file_load */
-- 
2.51.0



             reply	other threads:[~2025-10-16 20:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16 20:03 Zhu Yanjun [this message]
2025-10-21  9:41 ` [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing 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

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=20251016200320.4179702-1-yanjun.zhu@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.