[PATCH 2/3] hwmon: (occ) Fix missing newline in occ_show_extended()

Pradhan, Sanman posted 3 patches 6 days, 20 hours ago
[PATCH 2/3] hwmon: (occ) Fix missing newline in occ_show_extended()
Posted by Pradhan, Sanman 6 days, 20 hours ago
From: Sanman Pradhan <psanman@juniper.net>

In occ_show_extended() case 0, when the EXTN_FLAG_SENSOR_ID flag
is set, the sysfs_emit format string "%u" is missing the trailing
newline that the sysfs ABI expects. The else branch correctly uses
"%4phN\n", and all other show functions in this file include the
trailing newline.

Add the missing "\n" for consistency and correct sysfs output.

Fixes: c10e753d43eb ("hwmon (occ): Add sensor types and versions")
Signed-off-by: Sanman Pradhan <psanman@juniper.net>
---
 drivers/hwmon/occ/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index f02f815dc960..44d80d7a3497 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -725,7 +725,7 @@ static ssize_t occ_show_extended(struct device *dev,
 	switch (sattr->nr) {
 	case 0:
 		if (extn->flags & EXTN_FLAG_SENSOR_ID) {
-			rc = sysfs_emit(buf, "%u",
+			rc = sysfs_emit(buf, "%u\n",
 					get_unaligned_be32(&extn->sensor_id));
 		} else {
 			rc = sysfs_emit(buf, "%4phN\n", extn->name);
-- 
2.34.1

Re: [PATCH 2/3] hwmon: (occ) Fix missing newline in occ_show_extended()
Posted by Guenter Roeck 2 days, 22 hours ago
On Thu, Mar 26, 2026 at 10:45:29PM +0000, Pradhan, Sanman wrote:
> From: Sanman Pradhan <psanman@juniper.net>
> 
> In occ_show_extended() case 0, when the EXTN_FLAG_SENSOR_ID flag
> is set, the sysfs_emit format string "%u" is missing the trailing
> newline that the sysfs ABI expects. The else branch correctly uses
> "%4phN\n", and all other show functions in this file include the
> trailing newline.
> 
> Add the missing "\n" for consistency and correct sysfs output.
> 
> Fixes: c10e753d43eb ("hwmon (occ): Add sensor types and versions")
> Signed-off-by: Sanman Pradhan <psanman@juniper.net>

Applied.

Thanks,
Guenter