Skip to contentSkip to conversation

powercap: dtpm: Fix format string issues in log messages

PATCH In review Sumeet Pawnikar 2 participants 2 messages Dec 19, 2025 – Jan 7

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

PATCH 1/1 powercap: dtpm: Fix format string issues in log messages

Fix few format string issues in dtpm.c file,
- Extra trailing comma and space in the debug message "Registered dtpm node '%s' / %llu-%llu uW, \n". This unnecessary trailing ", " before the newline character, resulting an illusion of some more message available for this under debug output.

- Incorrect log level for subsystem initialization failure message. There is an error condition, not informational, and should be logged at error level for consistency with other failure mssages. Changed pr_info() to pr_err() for this subsystem initialization failure message.

- The same error message "Failed to initialize '%s': %d" has missing a trailing newline, which could cause log messages to be concatenated incorrectly, making the logs harder to read.

These isseus affect log readability and consistency but do not impact any functionality.

---
 drivers/powercap/dtpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/powercap/dtpm.c +2 -2
index 129d55bc705c..2179f5c0fbbe 100644
@@ -406,7 +406,7 @@ int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm *parent)
 		dtpm->power_limit = dtpm->power_max;
 	}
 
-	pr_debug("Registered dtpm node '%s' / %llu-%llu uW, \n",
+	pr_debug("Registered dtpm node '%s' / %llu-%llu uW\n",
 		 dtpm->zone.name, dtpm->power_min, dtpm->power_max);
 
 	return 0;
@@ -582,7 +582,7 @@ int dtpm_create_hierarchy(struct of_device_id *dtpm_match_table)
 
 		ret = dtpm_subsys[i]->init();
 		if (ret)
-			pr_info("Failed to initialize '%s': %d",
+			pr_err("Failed to initialize '%s': %d\n",
 				dtpm_subsys[i]->name, ret);
 	}
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 7 lines · Sumeet Pawnikar

Fix few format string issues in dtpm.c file,
- Extra trailing comma and space in the debug message "Registered dtpm node '%s' / %llu-%llu uW, \n". This unnecessary trailing ", " before the newline character, resulting an illusion of some more message available for this under debug output.

Quoted 5 lines

- Incorrect log level for subsystem initialization failure message. There is an error condition, not informational, and should be logged at error level for consistency with other failure mssages. Changed pr_info() to pr_err() for this subsystem initialization failure message.

Please leave it as is.

Error-level messages in the kernel log are only useful if the user/admin of the system can do something about them, but this doesn't seem to be the case here.