* [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
@ 2025-10-16 20:03 Zhu Yanjun
2025-10-21 9:41 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Zhu Yanjun @ 2025-10-16 20:03 UTC (permalink / raw)
To: kexec, linux-mm; +Cc: Zhu Yanjun, graf, rppt, changyuanl, akpm, bhe
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
2025-10-16 20:03 [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing Zhu Yanjun
@ 2025-10-21 9:41 ` Simon Horman
2025-10-21 13:56 ` Zhu Yanjun
2025-10-21 22:42 ` yanjun.zhu
0 siblings, 2 replies; 4+ messages in thread
From: Simon Horman @ 2025-10-21 9:41 UTC (permalink / raw)
To: Zhu Yanjun; +Cc: kexec, linux-mm, graf, rppt, changyuanl, akpm, bhe
On Thu, Oct 16, 2025 at 08:03:20PM +0000, Zhu Yanjun 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>
Thanks,
This looks good to me, even though I note that this file
has moved in linux-next.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
2025-10-21 9:41 ` Simon Horman
@ 2025-10-21 13:56 ` Zhu Yanjun
2025-10-21 22:42 ` yanjun.zhu
1 sibling, 0 replies; 4+ messages in thread
From: Zhu Yanjun @ 2025-10-21 13:56 UTC (permalink / raw)
To: Simon Horman; +Cc: kexec, linux-mm, graf, rppt, changyuanl, akpm, bhe
在 2025/10/21 2:41, Simon Horman 写道:
> On Thu, Oct 16, 2025 at 08:03:20PM +0000, Zhu Yanjun 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>
> Thanks,
>
> This looks good to me, even though I note that this file
> has moved in linux-next.
Thanks a lot.
Yanjun.Zhu
>
> Reviewed-by: Simon Horman <horms@kernel.org>
--
Best Regards,
Yanjun.Zhu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing
2025-10-21 9:41 ` Simon Horman
2025-10-21 13:56 ` Zhu Yanjun
@ 2025-10-21 22:42 ` yanjun.zhu
1 sibling, 0 replies; 4+ messages in thread
From: yanjun.zhu @ 2025-10-21 22:42 UTC (permalink / raw)
To: Simon Horman; +Cc: kexec, linux-mm, graf, rppt, changyuanl, akpm, bhe
On 10/21/25 2:41 AM, Simon Horman wrote:
> On Thu, Oct 16, 2025 at 08:03:20PM +0000, Zhu Yanjun 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>
>
> Thanks,
>
> This looks good to me, even though I note that this file
> has moved in linux-next.
Thank you very much. In next-20251021, I noticed that the directory is
now kernel/liveupdate/.
If a new commit is needed to reflect this change, please feel free to
let me know.
Yanjun.Zhu
>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-21 22:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16 20:03 [PATCH 1/1] kexec: Use %pe format specifier for error pointer printing Zhu Yanjun
2025-10-21 9:41 ` Simon Horman
2025-10-21 13:56 ` Zhu Yanjun
2025-10-21 22:42 ` yanjun.zhu
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).