* [PATCH] perf/x86/amd: Replace snprintf() with sysfs_emit()
@ 2022-04-22 2:37 Wan Jiabing
0 siblings, 0 replies; only message in thread
From: Wan Jiabing @ 2022-04-22 2:37 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, linux-perf-users, linux-kernel
Cc: kael_w, Wan Jiabing
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-22 2:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 2:37 [PATCH] perf/x86/amd: Replace snprintf() with sysfs_emit() Wan Jiabing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).