diff mbox series

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

Message ID 1612253940-19396-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive)
State Mainlined
Commit d883312489df262501d635b706be43080b30f1ec
Delegated to: Jiri Kosina
Headers show
Series HID: wacom: convert sysfs sprintf/snprintf family to sysfs_emit | expand

Commit Message

Jiapeng Chong Feb. 2, 2021, 8:19 a.m. UTC
Fix the following coccicheck warning:

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

Reported-by: Abaci Robot<abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/hid/wacom_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Kosina Feb. 5, 2021, 9:17 a.m. UTC | #1
On Tue, 2 Feb 2021, Jiapeng Chong wrote:

> Fix the following coccicheck warning:
> 
> ./drivers/hid/wacom_sys.c:1828:8-16: WARNING: use scnprintf or sprintf.
> 
> Reported-by: Abaci Robot<abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/hid/wacom_sys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index aa9e488..8328ef1 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -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.
diff mbox series

Patch

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index aa9e488..8328ef1 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -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,