[PATCH v1 4/8] Revert "UBUNTU: SAUCE: mlxbf_pmc: Fix references to sprintf"
Shravan Kumar Ramani
shravankr at nvidia.com
Tue Oct 17 11:29:41 UTC 2023
BugLink: https://bugs.launchpad.net/bugs/2039561
This reverts commit 287312e1cf134161b1a051e5d40ad7fdfb23bb2d.
Signed-off-by: Shravan Kumar Ramani <shravankr at nvidia.com>
---
drivers/platform/mellanox/mlxbf-pmc.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c
index fb3b770d092c..5a7ef716ffa6 100644
--- a/drivers/platform/mellanox/mlxbf-pmc.c
+++ b/drivers/platform/mellanox/mlxbf-pmc.c
@@ -681,7 +681,7 @@ static ssize_t mlxbf_counter_read(struct kobject *ko,
} else
return -EINVAL;
- return snprintf(buf, PAGE_SIZE, "0x%llx\n", value);
+ return sprintf(buf, "0x%llx\n", value);
}
/* Store function for "counter" sysfs files */
@@ -758,7 +758,7 @@ static ssize_t mlxbf_event_find(struct kobject *ko,
evt_name = mlxbf_pmc_get_event_name((char *)ko->name, evt_num);
- return snprintf(buf, PAGE_SIZE, "0x%llx: %s\n", evt_num, evt_name);
+ return sprintf(buf, "0x%llx: %s\n", evt_num, evt_name);
}
/* Store function for "event" sysfs files */
@@ -811,12 +811,9 @@ static ssize_t mlxbf_print_event_list(struct kobject *ko,
buf[0] = '\0';
while (events[i].evt_name != NULL) {
- size += snprintf(e_info,
- sizeof(e_info),
- "%x: %s\n",
- events[i].evt_num,
- events[i].evt_name);
- if (size >= PAGE_SIZE)
+ size += sprintf(e_info, "%x: %s\n", events[i].evt_num,
+ events[i].evt_name);
+ if (size > PAGE_SIZE)
break;
strcat(buf, e_info);
ret = size;
@@ -843,7 +840,7 @@ static ssize_t mlxbf_show_counter_state(struct kobject *ko,
value = FIELD_GET(MLXBF_L3C_PERF_CNT_CFG__EN, perfcnt_cfg);
- return snprintf(buf, PAGE_SIZE, "%d\n", value);
+ return sprintf(buf, "%d\n", value);
}
/* Store function for "enable" sysfs files - only for l3cache */
--
2.30.1
More information about the kernel-team
mailing list