Skip to content

Commit 8f0acb7

Browse files
zhijianli88KAGA-KOKO
authored andcommitted
clocksource: Convert s[n]printf() to sysfs_emit()
Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240314100402.1326582-1-lizhijian@fujitsu.com
1 parent d030456 commit 8f0acb7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/time/clocksource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ static ssize_t current_clocksource_show(struct device *dev,
13341334
ssize_t count = 0;
13351335

13361336
mutex_lock(&clocksource_mutex);
1337-
count = snprintf(buf, PAGE_SIZE, "%s\n", curr_clocksource->name);
1337+
count = sysfs_emit(buf, "%s\n", curr_clocksource->name);
13381338
mutex_unlock(&clocksource_mutex);
13391339

13401340
return count;

0 commit comments

Comments
 (0)