macintosh: ams: replace snprintf in show functions with sysfs_emit
PATCH 1/1 macintosh: ams: replace snprintf in show functions with sysfs_emit
show() must not use snprintf() when formatting the value to be returned to user space.
Fix the following coccicheck warning:drivers/macintosh/ams/ams-core.c:53: WARNING: use scnprintf or sprintf.
Use sysfs_emit instead of scnprintf or sprintf makes more sense.
Signed-off-by Qing Wang <[email protected]>
--- drivers/macintosh/ams/ams-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/ams/ams-core.c +1 -1
@@ -50,7 +50,7 @@ static ssize_t ams_show_current(struct device *dev,ams_sensors (&x, &y, &z);mutex_unlock (&ams_info.lock); -return snprintf (buf,PAGE_SIZE ,"%d %d %d\n" , x, y, z); +return sysfs_emit (buf,"%d %d %d\n" , x, y, z); } static DEVICE_ATTR(current, S_IRUGO, ams_show_current, NULL);
Signature · 1 line
2.7.4