Skip to content

Commit 08411e3

Browse files
Qing Wangbroonie
authored andcommitted
spi: 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/spi/spi-tle62x0.c:144: WARNING: use scnprintf or sprintf. Use sysfs_emit instead of scnprintf or sprintf makes more sense. Signed-off-by: Qing Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 2a4a4e8 commit 08411e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-tle62x0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static ssize_t tle62x0_gpio_show(struct device *dev,
141141
value = (st->gpio_state >> gpio_num) & 1;
142142
mutex_unlock(&st->lock);
143143

144-
return snprintf(buf, PAGE_SIZE, "%d", value);
144+
return sysfs_emit(buf, "%d", value);
145145
}
146146

147147
static ssize_t tle62x0_gpio_store(struct device *dev,

0 commit comments

Comments
 (0)