]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: gadget: f_uac2: replace scnprintf() with sysfs_emit()
authorSumanth Gavini <sumanth.gavini@yahoo.com>
Fri, 4 Jul 2025 00:34:22 +0000 (19:34 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Jul 2025 09:05:30 +0000 (11:05 +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/20250704003425.467299-1-sumanth.gavini@yahoo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_uac2.c

index 9b324821c93bd084430ce779ed481102a038068b..dd252ff2fb4e378cc79086a7877637a77adad24b 100644 (file)
@@ -2052,7 +2052,7 @@ static ssize_t f_uac2_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;                                                  \