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));
                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 via email to