diff mbox series

hwrng: core - Use sysfs_emit to replace snprintf

Message ID 1616377476-27337-1-git-send-email-tiantao6@hisilicon.com
State New
Headers show
Series hwrng: core - Use sysfs_emit to replace snprintf | expand

Commit Message

Tian Tao March 22, 2021, 1:44 a.m. UTC
Fix the following coccicheck warning:
drivers/char/hw_random//core.c:399:8-16: WARNING: use scnprintf or
sprintf

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/char/hw_random/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 8c1c47d..adb3c2b 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -396,7 +396,7 @@  static ssize_t hwrng_attr_selected_show(struct device *dev,
 					struct device_attribute *attr,
 					char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", cur_rng_set_by_user);
+	return sysfs_emit(buf, "%d\n", cur_rng_set_by_user);
 }
 
 static DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR,