Skip to contentSkip to conversation

iio: light: stk3310: replace sprintf() with safer sysfs_emit()

PATCH Applied Adi Kadušić 2 participants 2 messages Oct 23 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: light: stk3310: replace sprintf() with safer sysfs_emit()

This patch replaces sprintf() with sysfs_emit() safer alternative with no functional changes.

---
 drivers/iio/light/stk3310.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/light/stk3310.c +1 -2
index 0a16e326e939..e751e7c97bc1 100644
@@ -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[] = {
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 4 lines · On Fri, 23 Oct 2026 22:25:40 +0200 Adi Kadušić <[email protected]> wrote:

This patch replaces sprintf() with sysfs_emit() safer alternative with no functional changes.

Applied.

Quoted 25 lines
---
 drivers/iio/light/stk3310.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/light/stk3310.c +1 -2
index 0a16e326e939..e751e7c97bc1 100644
@@ -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[] = {