]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/memory-failure: replace sprintf() with sysfs_emit()
authorzhangguopeng <zhangguopeng@kylinos.cn>
Tue, 29 Oct 2024 10:18:53 +0000 (18:18 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 1 Nov 2024 04:29:33 +0000 (21:29 -0700)
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.

Link: https://lkml.kernel.org/r/20241029101853.37890-1-zhangguopeng@kylinos.cn
Signed-off-by: zhangguopeng <zhangguopeng@kylinos.cn>
Acked-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory-failure.c

index 7ce7ba8586f5a8a27c8cddf336f0a894707bb34a..a7b8ccd29b6f52d5e946051300d3f40820e94dee 100644 (file)
@@ -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)