From: Zhu Yanjun <yanjun.zhu@linux.dev>
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.
Note, that some err are still printed by value, as those errors
might come from libfdt and not regular errnos.
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Co-developed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
kernel/liveupdate/kexec_handover.c | 4 ++--
kernel/liveupdate/kexec_handover_debugfs.c | 10 ++++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
index be945c133a2f..167c761988d3 100644
--- a/kernel/liveupdate/kexec_handover.c
+++ b/kernel/liveupdate/kexec_handover.c
@@ -1448,8 +1448,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);
diff --git a/kernel/liveupdate/kexec_handover_debugfs.c b/kernel/liveupdate/kexec_handover_debugfs.c
index 46e9e6c0791f..ac739d25094d 100644
--- a/kernel/liveupdate/kexec_handover_debugfs.c
+++ b/kernel/liveupdate/kexec_handover_debugfs.c
@@ -150,8 +150,8 @@ __init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt)
err = __kho_debugfs_fdt_add(&dbg->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;
}
}
@@ -168,8 +168,10 @@ __init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt)
* reviving state from KHO and setting up KHO for the next
* kexec.
*/
- if (err)
- pr_err("failed exposing handover FDT in debugfs: %d\n", err);
+ if (err) {
+ pr_err("failed exposing handover FDT in debugfs: %pe\n",
+ ERR_PTR(err));
+ }
}
__init int kho_out_debugfs_init(struct kho_debugfs *dbg)
--
2.51.1.930.gacf6e81ea2-goog
On Sat, Nov 01 2025, Pasha Tatashin wrote: > From: Zhu Yanjun <yanjun.zhu@linux.dev> > > 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. > > Note, that some err are still printed by value, as those errors > might come from libfdt and not regular errnos. There is fdt_strerror() that does this for libfdt errnos. Something to do in a follow up patch I suppose. > > Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev> > Co-developed-by: Pasha Tatashin <pasha.tatashin@soleen.com> > Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> > Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Pratyush Yadav <pratyush@kernel.org> [...] -- Regards, Pratyush Yadav
On Sat, Nov 01, 2025 at 10:23:25AM -0400, Pasha Tatashin wrote: > From: Zhu Yanjun <yanjun.zhu@linux.dev> > > 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. > > Note, that some err are still printed by value, as those errors > might come from libfdt and not regular errnos. > > Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev> > Co-developed-by: Pasha Tatashin <pasha.tatashin@soleen.com> > Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> > Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> > --- > kernel/liveupdate/kexec_handover.c | 4 ++-- > kernel/liveupdate/kexec_handover_debugfs.c | 10 ++++++---- > 2 files changed, 8 insertions(+), 6 deletions(-) -- Sincerely yours, Mike.
在 2025/11/1 7:23, Pasha Tatashin 写道:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>
> 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.
>
> Note, that some err are still printed by value, as those errors
> might come from libfdt and not regular errnos.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> Co-developed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Appreciate your help, Pasha
Yanjun.Zhu
> Reviewed-by: Simon Horman <horms@kernel.org>
> ---
> kernel/liveupdate/kexec_handover.c | 4 ++--
> kernel/liveupdate/kexec_handover_debugfs.c | 10 ++++++----
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index be945c133a2f..167c761988d3 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -1448,8 +1448,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);
> diff --git a/kernel/liveupdate/kexec_handover_debugfs.c b/kernel/liveupdate/kexec_handover_debugfs.c
> index 46e9e6c0791f..ac739d25094d 100644
> --- a/kernel/liveupdate/kexec_handover_debugfs.c
> +++ b/kernel/liveupdate/kexec_handover_debugfs.c
> @@ -150,8 +150,8 @@ __init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt)
> err = __kho_debugfs_fdt_add(&dbg->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;
> }
> }
> @@ -168,8 +168,10 @@ __init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt)
> * reviving state from KHO and setting up KHO for the next
> * kexec.
> */
> - if (err)
> - pr_err("failed exposing handover FDT in debugfs: %d\n", err);
> + if (err) {
> + pr_err("failed exposing handover FDT in debugfs: %pe\n",
> + ERR_PTR(err));
> + }
> }
>
> __init int kho_out_debugfs_init(struct kho_debugfs *dbg)
--
Best Regards,
Yanjun.Zhu
© 2016 - 2025 Red Hat, Inc.