lkml.org 
[lkml]   [2022]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] perf/x86/amd: Replace snprintf() with sysfs_emit()
Date
Fix the following coccicheck warning:
arch/x86/events/amd/core.c:1127:8-16: WARNING: use scnprintf or sprintf.

Use sysfs_emit() instead of snprintf().

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
arch/x86/events/amd/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index 8e1e818f8195..c1ced265c824 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -1124,7 +1124,7 @@ static ssize_t branches_show(struct device *cdev,
struct device_attribute *attr,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", x86_pmu.lbr_nr);
+ return sysfs_emit(buf, "%d\n", x86_pmu.lbr_nr);
}

static DEVICE_ATTR_RO(branches);
--
2.35.1
\
 
 \ /
  Last update: 2022-04-22 04:38    [W:0.081 / U:1.888 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site