Re: [PATCH] iio: light: stk3310: replace sprintf() with safer sysfs_emit()
From: Jonathan Cameron
Date: Fri Oct 23 2026 - 16:45:41 EST
On Fri, 23 Oct 2026 22:25:40 +0200
Adi Kadušić <kadusicadi1@xxxxxxxxx> wrote:
> This patch replaces sprintf() with sysfs_emit() safer alternative
> with no functional changes.
>
> Signed-off-by: Adi Kadušić <kadusicadi1@xxxxxxxxx>
Applied.
> ---
> drivers/iio/light/stk3310.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
> index 0a16e326e939..e751e7c97bc1 100644
> --- a/drivers/iio/light/stk3310.c
> +++ b/drivers/iio/light/stk3310.c
> @@ -18,7 +18,6 @@
> #include <linux/pm.h>
> #include <linux/property.h>
> #include <linux/regmap.h>
> -#include <linux/sprintf.h>
> #include <linux/sysfs.h>
> #include <linux/types.h>
>
> @@ -180,7 +179,7 @@ static ssize_t stk3310_read_near_level(struct iio_dev *indio_dev,
> {
> struct stk3310_data *data = iio_priv(indio_dev);
>
> - return sprintf(buf, "%u\n", data->ps_near_level);
> + return sysfs_emit(buf, "%u\n", data->ps_near_level);
> }
>
> static const struct iio_chan_spec_ext_info stk3310_ext_info[] = {