Skip to content

Commit 7e75c33

Browse files
Qing Wangherbertx
authored andcommitted
hwrng: s390 - replace snprintf in show functions with sysfs_emit
coccicheck complains about the use of snprintf() in sysfs show functions. Fix the following coccicheck warning: drivers/char/hw_random/s390-trng.c:114:8-16: WARNING: use scnprintf or sprintf. drivers/char/hw_random/s390-trng.c:122:8-16: 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: Herbert Xu <[email protected]>
1 parent 06f6e36 commit 7e75c33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/char/hw_random/s390-trng.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ static ssize_t trng_counter_show(struct device *dev,
111111
#if IS_ENABLED(CONFIG_ARCH_RANDOM)
112112
u64 arch_counter = atomic64_read(&s390_arch_random_counter);
113113

114-
return snprintf(buf, PAGE_SIZE,
114+
return sysfs_emit(buf,
115115
"trng: %llu\n"
116116
"hwrng: %llu\n"
117117
"arch: %llu\n"
118118
"total: %llu\n",
119119
dev_counter, hwrng_counter, arch_counter,
120120
dev_counter + hwrng_counter + arch_counter);
121121
#else
122-
return snprintf(buf, PAGE_SIZE,
122+
return sysfs_emit(buf,
123123
"trng: %llu\n"
124124
"hwrng: %llu\n"
125125
"total: %llu\n",

0 commit comments

Comments
 (0)