]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usbip: convert sysfs snprintf to sysfs_emit
authorXuezhi Zhang <zhangxuezhi1@coolpad.com>
Fri, 14 Oct 2022 11:06:06 +0000 (19:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Oct 2022 11:21:23 +0000 (13:21 +0200)
Follow the advice of the Documentation/filesystems/sysfs.rst
and show() should only use sysfs_emit() or sysfs_emit_at()
when formatting the value to be returned to user space.

Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20221014110606.599352-1-zhangxuezhi3@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/stub_dev.c

index 3c6d452e3bf40e58ddd0fd952c0a15c4435dd108..f92047d860f07e404fcfa356e4a3c43bb19173b2 100644 (file)
@@ -30,7 +30,7 @@ static ssize_t usbip_status_show(struct device *dev,
        status = sdev->ud.status;
        spin_unlock_irq(&sdev->ud.lock);
 
-       return snprintf(buf, PAGE_SIZE, "%d\n", status);
+       return sysfs_emit(buf, "%d\n", status);
 }
 static DEVICE_ATTR_RO(usbip_status);