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.

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

authored by

Li Zhijian and committed by
Thomas Gleixner
8f0acb7f d0304569

+1 -1
+1 -1
kernel/time/clocksource.c
··· 1334 1334 ssize_t count = 0; 1335 1335 1336 1336 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); 1338 1338 mutex_unlock(&clocksource_mutex); 1339 1339 1340 1340 return count;