linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: zhangguopeng <zhangguopeng@kylinos.cn>
To: linmiaohe@huawei.com, linux-mm@kvack.org
Cc: nao.horiguchi@gmail.com, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org,
	zhangguopeng <zhangguopeng@kylinos.cn>
Subject: [PATCH] mm/memory-failure: Replace sprintf() with sysfs_emit()
Date: Tue, 29 Oct 2024 18:18:53 +0800	[thread overview]
Message-ID: <20241029101853.37890-1-zhangguopeng@kylinos.cn> (raw)

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



             reply	other threads:[~2024-10-29 10:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 10:18 zhangguopeng [this message]
2024-10-30  1:51 ` Miaohe Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241029101853.37890-1-zhangguopeng@kylinos.cn \
    --to=zhangguopeng@kylinos.cn \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nao.horiguchi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox