Commit 13cc02f1 authored by Jules Irenge's avatar Jules Irenge Committed by Greg Kroah-Hartman

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: default avatarJules Irenge <jules.irenge@postgrad.manchester.ac.uk>
Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/YzhVIaNGdM33pcts@octinomonSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 375ac0b2
......@@ -242,7 +242,7 @@ static ssize_t usbip_status_show(struct device *dev,
status = udc->ud.status;
spin_unlock_irq(&udc->ud.lock);
return snprintf(out, PAGE_SIZE, "%d\n", status);
return sysfs_emit(out, "%d\n", status);
}
static DEVICE_ATTR_RO(usbip_status);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment