mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kernel/power/swap: Use %pe to print PTR_ERR()
@ 2026-06-15 19:18 Ronan Marchal
  2026-07-22 15:12 ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 2+ messages in thread
From: Ronan Marchal @ 2026-06-15 19:18 UTC (permalink / raw)
  To: rafael; +Cc: pavel, lenb, linux-pm, linux-kernel, Ronan Marchal

Use %pe format specifier instead of %ld with PTR_ERR() to print
error pointers as a symbolic error name (e.g. -ENOMEM) instead
of a raw integer value.

Signed-off-by: Ronan Marchal <ronanmarchal29@gmail.com>
---
 kernel/power/swap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 2e64869bb5a0..d86a343dbdb5 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -746,7 +746,7 @@ static int save_compressed_image(struct swap_map_handle *handle,
 
 		data[thr].cc = crypto_alloc_acomp(hib_comp_algo, 0, CRYPTO_ALG_ASYNC);
 		if (IS_ERR_OR_NULL(data[thr].cc)) {
-			pr_err("Could not allocate comp stream %ld\n", PTR_ERR(data[thr].cc));
+			pr_err("Could not allocate comp stream %pe\n", data[thr].cc);
 			ret = -EFAULT;
 			goto out_clean;
 		}
@@ -1250,7 +1250,7 @@ static int load_compressed_image(struct swap_map_handle *handle,
 
 		data[thr].cc = crypto_alloc_acomp(hib_comp_algo, 0, CRYPTO_ALG_ASYNC);
 		if (IS_ERR_OR_NULL(data[thr].cc)) {
-			pr_err("Could not allocate comp stream %ld\n", PTR_ERR(data[thr].cc));
+			pr_err("Could not allocate comp stream %pe\n", data[thr].cc);
 			ret = -EFAULT;
 			goto out_clean;
 		}
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] kernel/power/swap: Use %pe to print PTR_ERR()
  2026-06-15 19:18 [PATCH] kernel/power/swap: Use %pe to print PTR_ERR() Ronan Marchal
@ 2026-07-22 15:12 ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-07-22 15:12 UTC (permalink / raw)
  To: Ronan Marchal; +Cc: rafael, pavel, lenb, linux-pm, linux-kernel

On Mon, Jun 15, 2026 at 9:18 PM Ronan Marchal <ronanmarchal29@gmail.com> wrote:
>
> Use %pe format specifier instead of %ld with PTR_ERR() to print
> error pointers as a symbolic error name (e.g. -ENOMEM) instead
> of a raw integer value.
>
> Signed-off-by: Ronan Marchal <ronanmarchal29@gmail.com>
> ---
>  kernel/power/swap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/power/swap.c b/kernel/power/swap.c
> index 2e64869bb5a0..d86a343dbdb5 100644
> --- a/kernel/power/swap.c
> +++ b/kernel/power/swap.c
> @@ -746,7 +746,7 @@ static int save_compressed_image(struct swap_map_handle *handle,
>
>                 data[thr].cc = crypto_alloc_acomp(hib_comp_algo, 0, CRYPTO_ALG_ASYNC);
>                 if (IS_ERR_OR_NULL(data[thr].cc)) {
> -                       pr_err("Could not allocate comp stream %ld\n", PTR_ERR(data[thr].cc));
> +                       pr_err("Could not allocate comp stream %pe\n", data[thr].cc);
>                         ret = -EFAULT;
>                         goto out_clean;
>                 }
> @@ -1250,7 +1250,7 @@ static int load_compressed_image(struct swap_map_handle *handle,
>
>                 data[thr].cc = crypto_alloc_acomp(hib_comp_algo, 0, CRYPTO_ALG_ASYNC);
>                 if (IS_ERR_OR_NULL(data[thr].cc)) {
> -                       pr_err("Could not allocate comp stream %ld\n", PTR_ERR(data[thr].cc));
> +                       pr_err("Could not allocate comp stream %pe\n", data[thr].cc);
>                         ret = -EFAULT;
>                         goto out_clean;
>                 }
> --

Applied as 7.3 material (with a modified subject), thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-22 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-15 19:18 [PATCH] kernel/power/swap: Use %pe to print PTR_ERR() Ronan Marchal
2026-07-22 15:12 ` Rafael J. Wysocki (Intel)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®