Skip to contentSkip to conversation

ACPI: use %pe for better readability of errors while printing

PATCH Superseded Onkarnarth 2 participants 3 messages Feb 12, 2024 1 message not in the archive

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20240212102417epcas5p31745b234ab239009c7ff29d0f59c1126@epcas5p3.samsung.com

Onkarnarth

author
#1 lore raw

PATCH v2 1/2 ACPI: use %pe for better readability of errors while printing

From: Onkarnath <[email protected]>

As %pe is already introduced, it's better to use it in place of (%ld) for printing errors in logs. It would enhance readability of logs.

---
v1->v2: Updated subject line as per file history & corrected spellings in description.

 drivers/acpi/acpi_processor.c | 2 +-
 drivers/acpi/acpi_watchdog.c  | 2 +-
 drivers/acpi/pci_slot.c       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/acpi_processor.c +1 -1
index 4fe2ef54088c..2ddd36a21850 100644
@@ -161,7 +161,7 @@ static void cpufreq_add_device(const char *name)
 
 	pdev = platform_device_register_simple(name, PLATFORM_DEVID_NONE, NULL, 0);
 	if (IS_ERR(pdev))
-		pr_info("%s device creation failed: %ld\n", name, PTR_ERR(pdev));
+		pr_info("%s device creation failed: %pe\n", name, pdev);
 }
 
 #ifdef CONFIG_X86
drivers/acpi/acpi_watchdog.c +1 -1
index 8e9e001da38f..14b24157799c 100644
@@ -179,7 +179,7 @@ void __init acpi_watchdog_init(void)
 	pdev = platform_device_register_simple("wdat_wdt", PLATFORM_DEVID_NONE,
 					       resources, nresources);
 	if (IS_ERR(pdev))
-		pr_err("Device creation failed: %ld\n", PTR_ERR(pdev));
+		pr_err("Device creation failed: %pe\n", pdev);
 
 	kfree(resources);
 
drivers/acpi/pci_slot.c +1 -1
index d6cb2c27a23b..741bcc9d6d6a 100644
@@ -111,7 +111,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
 	snprintf(name, sizeof(name), "%llu", sun);
 	pci_slot = pci_create_slot(pci_bus, device, name, NULL);
 	if (IS_ERR(pci_slot)) {
-		pr_err("pci_create_slot returned %ld\n", PTR_ERR(pci_slot));
+		pr_err("pci_create_slot returned %pe\n", pci_slot);
 		kfree(slot);
 		return AE_OK;
 	}
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH v2 2/2 cpufreq/schedutil: print errors with %pe for better readability of logs

From: Onkarnath <[email protected]>

Instead of printing errros as a number(%ld), it's better to print in string format for better readability of logs.

---
v1->v2: Updated subject as per file history

 kernel/sched/cpufreq_schedutil.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/cpufreq_schedutil.c +1 -1
index eece6244f9d2..2c42eaa56fa3 100644
@@ -671,7 +671,7 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)
 				"sugov:%d",
 				cpumask_first(policy->related_cpus));
 	if (IS_ERR(thread)) {
-		pr_err("failed to create sugov thread: %ld\n", PTR_ERR(thread));
+		pr_err("failed to create sugov thread: %pe\n", thread);
 		return PTR_ERR(thread);
 	}
 
Signature · 1 line
2.25.1
#3 lore raw
In reply to Onkarnarth
Quoted 9 lines · Onkarnarth

From: Onkarnath <[email protected]>

As %pe is already introduced, it's better to use it in place of (%ld) for printing errors in logs. It would enhance readability of logs.

This tag is wrong. I provided some feedback, but that's not the same as providing a "Reviewed-by" tag. "Reviewed-by" has a very specific meaning and the reviewer must provide it explicitly; details here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=v6.7#n544

Bjorn