Skip to contentSkip to conversation

perf/x86/core: Replace snprintf() with sysfs_emit()

PATCH New Jiapeng Chong 1 participant 1 message Jun 17, 2022

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

PATCH 1/1 perf/x86/core: Replace snprintf() with sysfs_emit()

coccicheck complains about the use of snprintf() in sysfs show functions.

./arch/x86/events/core.c:2627:8-16: WARNING: use scnprintf or sprintf.

---
 arch/x86/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/core.c +1 -1
index f969410d0c90..7a1a42768122 100644
@@ -2624,7 +2624,7 @@ static ssize_t max_precise_show(struct device *cdev,
 				  struct device_attribute *attr,
 				  char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", x86_pmu_max_precise());
+	return sysfs_emit(buf, "%d\n", x86_pmu_max_precise());
 }
 
 static DEVICE_ATTR_RO(max_precise);
Signature · 1 line
2.20.1.7.g153144c