diff mbox series

mm/memory-failure: Replace sprintf() with sysfs_emit()

Message ID 20241029101853.37890-1-zhangguopeng@kylinos.cn (mailing list archive)
State New
Headers show
Series mm/memory-failure: Replace sprintf() with sysfs_emit() | expand

Commit Message

zhangguopeng Oct. 29, 2024, 10:18 a.m. UTC
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@kylinos.cn>
---
 mm/memory-failure.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Miaohe Lin Oct. 30, 2024, 1:51 a.m. UTC | #1
On 2024/10/29 18:18, zhangguopeng wrote:
> 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@kylinos.cn>

Acked-by: Miaohe Lin <linmiaohe@huawei.com>
Thanks.
.
diff mbox series

Patch

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)