Skip to contentSkip to conversation

staging: greybus: fw-core: use %pe for error printing

PATCH In review Archit Anant 2 participants 3 messages Jan 18 – Jan 19

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

cover staging: greybus: fw-core: use %pe for error printing

This patch modernizes error printing in the Greybus firmware core driver.

It replaces the old 'PTR_ERR' + '%ld' pattern with the newer '%pe' format specifier, which prints error names instead of numbers, making it easy for debuging.

Archit Anant (1):
staging: greybus: fw-core: use %pe for error printing

 drivers/staging/greybus/fw-core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.39.5
#1 lore raw

PATCH 1/1 staging: greybus: fw-core: use %pe for error printing

Use the %pe printk format specifier to print error codes as symbolic names (e.g., -ENOMEM) instead of numeric values. This improves readability of error logs.

Issue identified by coccicheck using the ptr_err_to_pe.cocci script.

---
 drivers/staging/greybus/fw-core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/greybus/fw-core.c +6 -6
index 0fb15a60412f..1ad404d69b87 100644
@@ -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;
 			}
Signature · 1 line
2.39.5
maintainer
#2 lore raw

[ +CC: Julia ]

Quoted 3 lines · Archit Anant

Use the %pe printk format specifier to print error codes as symbolic names (e.g., -ENOMEM) instead of numeric values. This improves readability of error logs.

Greybus and this driver uses numerical errnos in its error messages so this will introduce a needless inconsistency for no good reason.

Quoted 1 line

Issue identified by coccicheck using the ptr_err_to_pe.cocci script.

Also see:

	https://lore.kernel.org/all/[email protected]/

Johan