Re: [PATCH] kernel/power/swap: Use %pe to print PTR_ERR()

From: Rafael J. Wysocki (Intel)

Date: Wed Jul 22 2026 - 11:20:17 EST


On Mon, Jun 15, 2026 at 9:18 PM Ronan Marchal <ronanmarchal29@xxxxxxxxx> 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@xxxxxxxxx>
> ---
> 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!