[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241029101853.37890-1-zhangguopeng@kylinos.cn>
Date: Tue, 29 Oct 2024 18:18:53 +0800
From: zhangguopeng <zhangguopeng@...inos.cn>
To: linmiaohe@...wei.com,
linux-mm@...ck.org
Cc: nao.horiguchi@...il.com,
akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org,
zhangguopeng <zhangguopeng@...inos.cn>
Subject: [PATCH] mm/memory-failure: Replace sprintf() with sysfs_emit()
As Documentation/filesystems/sysfs.rst suggested, show() should only
use sysfs_emit() or sysfs_emit_at() when formatting the value to be
returned to user space.
Signed-off-by: zhangguopeng <zhangguopeng@...inos.cn>
---
mm/memory-failure.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 7194d6639720..fff849daceba 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -100,7 +100,7 @@ static ssize_t _name##_show(struct device *dev, \
{ \
struct memory_failure_stats *mf_stats = \
&NODE_DATA(dev->id)->mf_stats; \
- return sprintf(buf, "%lu\n", mf_stats->_name); \
+ return sysfs_emit(buf, "%lu\n", mf_stats->_name); \
} \
static DEVICE_ATTR_RO(_name)
--
2.25.1
Powered by blists - more mailing lists