On Thu, Oct 16, 2025 at 4:03 PM Zhu Yanjun <[email protected]> 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 <[email protected]>
> CC: [email protected]
> CC: [email protected]
> CC: [email protected]
> CC: [email protected]
> CC: [email protected]
>
> ---
>  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.

Reply via email to