]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: gadget: f_uac1: replace scnprintf() with sysfs_emit()
authorSumanth Gavini <sumanth.gavini@yahoo.com>
Fri, 18 Jul 2025 17:50:35 +0000 (12:50 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Jul 2025 14:31:28 +0000 (16:31 +0200)
Documentation/filesystems/sysfs.rst mentions that show() should only
use sysfs_emit() or sysfs_emit_at() when formating the value to be
returned to user space. So replace scnprintf() with sysfs_emit().

Signed-off-by: Sumanth Gavini <sumanth.gavini@yahoo.com>
Link: https://lore.kernel.org/r/20250718175037.299710-1-sumanth.gavini@yahoo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_uac1.c

index c87e74afc88159581cd23446db3889dd22a10324..9da9fb4e12395f558dc3a9a3b57447e68110707f 100644 (file)
@@ -1634,7 +1634,7 @@ static ssize_t f_uac1_opts_##name##_show(struct config_item *item,        \
        int result;                                                     \
                                                                        \
        mutex_lock(&opts->lock);                                        \
-       result = scnprintf(page, sizeof(opts->name), "%s", opts->name); \
+       result = sysfs_emit(page, "%s", opts->name);                    \
        mutex_unlock(&opts->lock);                                      \
                                                                        \
        return result;                                                  \