Skip to contentSkip to conversation

kernel/power/swap: Use %pe to print PTR_ERR()

PATCH Applied Ronan Marchal 2 participants 2 messages Jun 15 – Jul 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/power/swap: Use %pe to print PTR_ERR()

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.

---
 kernel/power/swap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/power/swap.c +2 -2
index 2e64869bb5a0..d86a343dbdb5 100644
@@ -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;
 		}
Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw
Quoted 24 lines · 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.

---
 kernel/power/swap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/power/swap.c +1 -1
index 2e64869bb5a0..d86a343dbdb5 100644
@@ -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;
                }

kernel/power/swap.c static int load_compressed_image(struct swap_map_handle *handle,

Quoted 9 lines
kernel/power/swap.c +1 -2
@@ -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!