iio: light: Convert sysfs sprintf/snprintf family to sysfs_emit
authorTian Tao <tiantao6@hisilicon.com>
Mon, 12 Apr 2021 08:39:10 +0000 (16:39 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 17 May 2021 12:49:05 +0000 (13:49 +0100)
Fix the following coccicheck warning:
drivers/iio/light/veml6030.c:131:8-16: WARNING:
use scnprintf or sprintf

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Link: https://lore.kernel.org/r/1618216751-1678-3-git-send-email-tiantao6@hisilicon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/veml6030.c

index de85c9b30be1e9258f3ae4f768768af8fa07cafc..3c937c55a10d89d9b478cc360191adaa1b77e68a 100644 (file)
@@ -128,7 +128,7 @@ static ssize_t in_illuminance_period_available_show(struct device *dev,
                return -EINVAL;
        }
 
-       return snprintf(buf, PAGE_SIZE, "%s\n", period_values[x]);
+       return sysfs_emit(buf, "%s\n", period_values[x]);
 }
 
 static IIO_DEVICE_ATTR_RO(in_illuminance_period_available, 0);