aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQing Wang <[email protected]>2021-10-14 23:49:04 -0700
committerMichael Ellerman <[email protected]>2022-05-04 19:37:45 +1000
commitcc4639989e93f5be6445e1466937e0a455f9bd88 (patch)
tree66545be2021d02fb9654af84d775131a2124cf8a
parent5749e7c1aa8c25ca11a8c8cac71d1a052231ef51 (diff)
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]> Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--drivers/macintosh/ams/ams-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/macintosh/ams/ams-core.c b/drivers/macintosh/ams/ams-core.c
index 01eeb2336d1a..877e8cb23128 100644
--- a/drivers/macintosh/ams/ams-core.c
+++ b/drivers/macintosh/ams/ams-core.c
@@ -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);