From: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Al Viro <viro@zeniv.linux.org.uk>, Sam Day <me@samcday.com>,
Christian Brauner <brauner@kernel.org>,
Chen Ni <nichen@iscas.ac.cn>, Mateusz Guzik <mjguzik@gmail.com>,
Liang Jie <liangjie@lixiang.com>,
Ingo Rohloff <ingo.rohloff@lauterbach.com>,
Owen Gu <guhuinan@xiaomi.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
Subject: [PATCH 1/2] usb: gadget: f_fs: Use sysfs_emit() in configfs show function
Date: Sat, 31 Jan 2026 21:31:10 +0530 [thread overview]
Message-ID: <20260131160111.3161630-2-krishna.kurapati@oss.qualcomm.com> (raw)
In-Reply-To: <20260131160111.3161630-1-krishna.kurapati@oss.qualcomm.com>
Use sysfs_emit() instead of sprintf() in configfs attribute show function.
sysfs_emit() is the recommended API for sysfs output as it provides buffer
overflow protection and proper formatting.
No functional changes.
Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
---
drivers/usb/gadget/function/f_fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index c1826aa2f0f8..80dd42a7f391 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -3981,7 +3981,7 @@ static ssize_t f_fs_opts_ready_show(struct config_item *item, char *page)
ready = opts->dev->desc_ready;
ffs_dev_unlock();
- return sprintf(page, "%d\n", ready);
+ return sysfs_emit(page, "%d\n", ready);
}
CONFIGFS_ATTR_RO(f_fs_opts_, ready);
--
2.34.1
next prev parent reply other threads:[~2026-01-31 16:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-31 16:01 [PATCH 0/2] usb: gadget: Use sysfs_emit instead of sprintf Krishna Kurapati
2026-01-31 16:01 ` Krishna Kurapati [this message]
2026-01-31 16:01 ` [PATCH 2/2] usb: gadget: f_sourcesink: Use sysfs_emit() in configfs show functions Krishna Kurapati
2026-02-01 7:28 ` [PATCH 0/2] usb: gadget: Use sysfs_emit instead of sprintf Greg Kroah-Hartman
2026-02-01 10:31 ` Krishna Kurapati
2026-02-01 10:35 ` Greg Kroah-Hartman
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=20260131160111.3161630-2-krishna.kurapati@oss.qualcomm.com \
--to=krishna.kurapati@oss.qualcomm.com \
--cc=brauner@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=gregkh@linuxfoundation.org \
--cc=guhuinan@xiaomi.com \
--cc=ingo.rohloff@lauterbach.com \
--cc=liangjie@lixiang.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=me@samcday.com \
--cc=mjguzik@gmail.com \
--cc=nichen@iscas.ac.cn \
--cc=viro@zeniv.linux.org.uk \
/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