Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usbip: vudc: Convert snprintf() to sysfs_emit()

Coccinnelle reports a warning
Warning: Use scnprintf or sprintf

Following the advice on kernel documentation
https://www.kernel.org/doc/html/latest/filesystems/sysfs.html

For show(device *...) functions we should only use sysfs_emit() or sysfs_emit_at()
especially when formatting the value to be returned to user space.
Convert snprintf() to sysfs_emit()

Signed-off-by: Jules Irenge <jules.irenge@postgrad.manchester.ac.uk>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/YzhVIaNGdM33pcts@octinomon
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jules Irenge and committed by
Greg Kroah-Hartman
13cc02f1 375ac0b2

+1 -1
+1 -1
drivers/usb/usbip/vudc_sysfs.c
··· 242 242 status = udc->ud.status; 243 243 spin_unlock_irq(&udc->ud.lock); 244 244 245 - return snprintf(out, PAGE_SIZE, "%d\n", status); 245 + return sysfs_emit(out, "%d\n", status); 246 246 } 247 247 static DEVICE_ATTR_RO(usbip_status); 248 248