Skip to contentSkip to conversation

HID: wacom: convert sysfs sprintf/snprintf family to sysfs_emit

PATCH Applied Jiapeng Chong 2 participants 2 messages Feb 2, 2021 – Feb 5, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: wacom: convert sysfs sprintf/snprintf family to sysfs_emit

Fix the following coccicheck warning:

./drivers/hid/wacom_sys.c:1828:8-16: WARNING: use scnprintf or sprintf.

---
 drivers/hid/wacom_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/wacom_sys.c +1 -1
index aa9e488..8328ef1 100644
@@ -1825,7 +1825,7 @@ static ssize_t wacom_show_speed(struct device *dev,
 	struct hid_device *hdev = to_hid_device(dev);
 	struct wacom *wacom = hid_get_drvdata(hdev);
 
-	return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed);
+	return sysfs_emit(buf, "%i\n", wacom->wacom_wac.bt_high_speed);
 }
 
 static ssize_t wacom_store_speed(struct device *dev,
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw
Quoted 15 lines · Jiapeng Chong

Fix the following coccicheck warning:

./drivers/hid/wacom_sys.c:1828:8-16: WARNING: use scnprintf or sprintf.

---
 drivers/hid/wacom_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/wacom_sys.c +0 -0
index aa9e488..8328ef1 100644

drivers/hid/wacom_sys.c static ssize_t wacom_show_speed(struct device *dev, · line 1829

Quoted 6 lines
drivers/hid/wacom_sys.c +1 -1
@@ -1825,7 +1825,7 @@ static ssize_t wacom_show_speed(struct device *dev,
 	struct hid_device *hdev = to_hid_device(dev);
 	struct wacom *wacom = hid_get_drvdata(hdev);
 
-	return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed);
+	return sysfs_emit(buf, "%i\n", wacom->wacom_wac.bt_high_speed);
 }

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs