Skip to contentSkip to conversation

staging: fbtft: Use %pe format specifier for error pointers

PATCH In review Mahad Ibrahim 3 participants 4 messages Apr 12 – Apr 13

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

PATCH 1/1 staging: fbtft: Use %pe format specifier for error pointers

The %pe format specifier resolves error pointers to their symbolic representation. Previously %ld with PTR_ERR() was being used, %pe is a better alternative.

Fixes the following coccinelle warnings reported by coccicheck:
WARNING: Consider using %pe to print PTR_ERR()

Testing: I do not own the hardware, therefore I could not perform hardware testing. Compile tested only.

---
 drivers/staging/fbtft/fb_ssd1351.c | 3 +--
 drivers/staging/fbtft/fbtft-core.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/fbtft/fb_ssd1351.c +1 -2
index 6736b09b2f45..15524b80035a 100644
@@ -218,8 +218,7 @@ static void register_onboard_backlight(struct fbtft_par *par)
 				       &bl_props);
 	if (IS_ERR(bd)) {
 		dev_err(par->info->device,
-			"cannot register backlight device (%ld)\n",
-			PTR_ERR(bd));
+			"cannot register backlight device (%pe)\n", bd);
 		return;
 	}
 	par->info->bl_dev = bd;
drivers/staging/fbtft/fbtft-core.c +1 -2
index f427c0914907..823315dfbf5d 100644
@@ -187,8 +187,7 @@ void fbtft_register_backlight(struct fbtft_par *par)
 				       &fbtft_bl_ops, &bl_props);
 	if (IS_ERR(bd)) {
 		dev_err(par->info->device,
-			"cannot register backlight device (%ld)\n",
-			PTR_ERR(bd));
+			"cannot register backlight device (%pe)\n", bd);
 		return;
 	}
 	par->info->bl_dev = bd;
Signature · 1 line
2.39.5
#1 lore raw
Quoted 10 lines · Mahad Ibrahim

The %pe format specifier resolves error pointers to their symbolic representation. Previously %ld with PTR_ERR() was being used, %pe is a better alternative.

Fixes the following coccinelle warnings reported by coccicheck:
WARNING: Consider using %pe to print PTR_ERR()

Testing: I do not own the hardware, therefore I could not perform hardware testing. Compile tested only.

I don't think it makes any difference for this driver. But I am not objecting to the change. Up to Greg if he wants to apply or not.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Mahad Ibrahim

The %pe format specifier resolves error pointers to their symbolic representation. Previously %ld with PTR_ERR() was being used, %pe is a better alternative.

Quoted 8 lines
Quoted 5 lines

Fixes the following coccinelle warnings reported by coccicheck:
WARNING: Consider using %pe to print PTR_ERR()

Testing: I do not own the hardware, therefore I could not perform hardware testing. Compile tested only.

I don't think it makes any difference for this driver. But I am not objecting to the change. Up to Greg if he wants to apply or not.

I always like these changes. I wish that there were an equivalent %e which printed error codes that weren't stored in an error pointer.

KTODO: introduce a %e type format thing which prints error codes

regards,
dan carpenter

#3 lore raw
Quoted 3 lines · Dan Carpenter
Quoted 2 lines · Andy Shevchenko

On Sun, Apr 12, 2026 at 5:46 PM Mahad Ibrahim
<[email protected]> wrote:

...

Quoted 4 lines

I always like these changes. I wish that there were an equivalent %e which printed error codes that weren't stored in an error pointer.

KTODO: introduce a %e type format thing which prints error codes

Never happens until it becomes a C standard.

Signature · 2 lines
With Best Regards,
Andy Shevchenko