linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/memory-failure: Replace sprintf() with sysfs_emit()
@ 2024-10-29 10:18 zhangguopeng
  2024-10-30  1:51 ` Miaohe Lin
  0 siblings, 1 reply; 2+ messages in thread
From: zhangguopeng @ 2024-10-29 10:18 UTC (permalink / raw)
  To: linmiaohe, linux-mm; +Cc: nao.horiguchi, akpm, linux-kernel, zhangguopeng

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(-)

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/memory-failure: Replace sprintf() with sysfs_emit()
  2024-10-29 10:18 [PATCH] mm/memory-failure: Replace sprintf() with sysfs_emit() zhangguopeng
@ 2024-10-30  1:51 ` Miaohe Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Miaohe Lin @ 2024-10-30  1:51 UTC (permalink / raw)
  To: zhangguopeng, linux-mm; +Cc: nao.horiguchi, akpm, linux-kernel

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.
.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-30  1:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-29 10:18 [PATCH] mm/memory-failure: Replace sprintf() with sysfs_emit() zhangguopeng
2024-10-30  1:51 ` Miaohe Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox