Skip to contentSkip to conversation

hid: Replace snprintf() with sysfs_emit()

PATCH New [email protected] 1 participant 1 message Jul 13, 2023 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 hid: Replace snprintf() with sysfs_emit()

coccinelle report:
./drivers/scsi/mvsas/mv_init.c:699:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/mvsas/mv_init.c:747:8-16:
WARNING: use scnprintf or sprintf

./drivers/hid/hid-roccat-kovaplus.c:330:8-16: WARNING: use scnprintf or sprintf ./drivers/hid/hid-roccat-kovaplus.c:277:8-16: WARNING: use scnprintf or sprintf ./drivers/hid/hid-roccat-kovaplus.c:339:8-16: WARNING: use scnprintf or sprintf ./drivers/hid/hid-roccat-kovaplus.c:349:8-16: WARNING: use scnprintf or sprintf ./drivers/hid/hid-roccat-kovaplus.c:370:8-16: WARNING: use scnprintf or sprintf

---
 drivers/hid/hid-roccat-kovaplus.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hid/hid-roccat-kovaplus.c +2 -2
index 1a1d96e11683..282e26f55074 100644
@@ -274,7 +274,7 @@ static ssize_t kovaplus_sysfs_show_actual_profile(struct device *dev,
 {
     struct kovaplus_device *kovaplus =
             hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-    return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_profile);
+    return scnprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_profile);
 }
 
 static ssize_t kovaplus_sysfs_set_actual_profile(struct device *dev,
@@ -327,7 +327,7 @@ static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev,
 {
     struct kovaplus_device *kovaplus =
             hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
-    return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi);
+    return scnprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi);
 }
 static DEVICE_ATTR(actual_cpi, 0440, kovaplus_sysfs_show_actual_cpi, 

NULL);

@@ -336,7 +336,7 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev,
{
struct kovaplus_device *kovaplus =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
- return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity);
}
static DEVICE_ATTR(actual_sensitivity_x, 0440,

            kovaplus_sysfs_show_actual_sensitivity_x, NULL);

@@ -346,7 +346,7 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev,
{
struct kovaplus_device *kovaplus =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
- return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity);
}
static DEVICE_ATTR(actual_sensitivity_y, 0440,

            kovaplus_sysfs_show_actual_sensitivity_y, NULL);
@@ -367,7 +367,7 @@ static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev,
             &info, KOVAPLUS_SIZE_INFO);
     mutex_unlock(&kovaplus->kovaplus_lock);

- return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
}
static DEVICE_ATTR(firmware_version, 0440,

            kovaplus_sysfs_show_firmware_version, NULL);