[PATCH] staging: greybus: use %pe to print PTR_ERR in fw-core.c

Tomasz Unger posted 1 patch 3 weeks, 1 day ago
drivers/staging/greybus/fw-core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[PATCH] staging: greybus: use %pe to print PTR_ERR in fw-core.c
Posted by Tomasz Unger 3 weeks, 1 day ago
Replace PTR_ERR() with %pe format specifier which directly prints
the error pointer in a human readable way, making the code cleaner
and more idiomatic.

Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
---
Verified with checkpatch.pl - no errors or warnings.
Compiled the gb-firmware module successfully.
Module compiles and loads in a QEMU environment.
---
 drivers/staging/greybus/fw-core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/greybus/fw-core.c b/drivers/staging/greybus/fw-core.c
index 2016a74f137f..7053afa9ab3e 100644
--- a/drivers/staging/greybus/fw-core.c
+++ b/drivers/staging/greybus/fw-core.c
@@ -112,8 +112,8 @@ static int gb_fw_core_probe(struct gb_bundle *bundle,
 			connection = gb_connection_create(bundle, cport_id,
 							  gb_fw_download_request_handler);
 			if (IS_ERR(connection)) {
-				dev_err(&bundle->dev, "failed to create download connection (%ld)\n",
-					PTR_ERR(connection));
+				dev_err(&bundle->dev, "failed to create download connection (%pe)\n",
+					connection);
 			} else {
 				fw_core->download_connection = connection;
 			}
@@ -131,8 +131,8 @@ static int gb_fw_core_probe(struct gb_bundle *bundle,
 			connection = gb_connection_create(bundle, cport_id,
 							  NULL);
 			if (IS_ERR(connection)) {
-				dev_err(&bundle->dev, "failed to create SPI connection (%ld)\n",
-					PTR_ERR(connection));
+				dev_err(&bundle->dev, "failed to create SPI connection (%pe)\n",
+					connection);
 			} else {
 				fw_core->spi_connection = connection;
 			}
@@ -149,8 +149,8 @@ static int gb_fw_core_probe(struct gb_bundle *bundle,
 			connection = gb_connection_create(bundle, cport_id,
 							  NULL);
 			if (IS_ERR(connection)) {
-				dev_err(&bundle->dev, "failed to create Authentication connection (%ld)\n",
-					PTR_ERR(connection));
+				dev_err(&bundle->dev, "failed to create Authentication connection (%pe)\n",
+					connection);
 			} else {
 				fw_core->cap_connection = connection;
 			}

---
base-commit: ad6bb64332bb4297110950769ad5af52791e33a2
change-id: 20260314-greybus-pe-format-85993705ee22

Best regards,
-- 
Tomasz Unger <tomasz.unger@yahoo.pl>
Re: [PATCH] staging: greybus: use %pe to print PTR_ERR in fw-core.c
Posted by Johan Hovold 3 weeks ago
On Sun, Mar 15, 2026 at 09:40:48AM +0100, Tomasz Unger wrote:
> Replace PTR_ERR() with %pe format specifier which directly prints
> the error pointer in a human readable way, making the code cleaner
> and more idiomatic.

No, this is only results in inconsistency as Greybus logs all other
errnos numerically (which is perfectly sufficient).

See also:

	https://lore.kernel.org/all/20251029132922.17329-1-johan@kernel.org/

Johan
Re: [PATCH] staging: greybus: use %pe to print PTR_ERR in fw-core.c
Posted by Ethan Tidmore 3 weeks, 1 day ago
On Sun Mar 15, 2026 at 3:40 AM CDT, Tomasz Unger wrote:
> Replace PTR_ERR() with %pe format specifier which directly prints
> the error pointer in a human readable way, making the code cleaner
> and more idiomatic.
>
> Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
> ---

LGTM.

Reviewed-by: Ethan Tidmore <ethantidmore06@gmail.com>

Thanks,

ET