* [PATCH] HID: logitech-hidpp: Replace devm_kasprintf() call by devm_kstrdup() in hidpp_connect_event()
@ 2025-04-16 13:32 Markus Elfring
0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2025-04-16 13:32 UTC (permalink / raw)
To: linux-input, Bastien Nocera, Benjamin Tissoires,
Filipe Laíns, Jiri Kosina
Cc: LKML, Chenyuan Yang, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 16 Apr 2025 15:25:05 +0200
Use a devm_kstrdup() call instead of a devm_kasprintf() call
in this function implementation because only a single string
should be copied.
The source code was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/hid/hid-logitech-hidpp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 10a3bc5f931b..c1a9ecde57c6 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -4216,8 +4216,7 @@ static void hidpp_connect_event(struct work_struct *work)
if (hidpp->name == hdev->name && hidpp->protocol_major >= 2) {
name = hidpp_get_device_name(hidpp);
if (name) {
- devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
- "%s", name);
+ devm_name = devm_kstrdup(&hdev->dev, name, GFP_KERNEL);
kfree(name);
if (!devm_name)
return;
--
2.49.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-04-16 13:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-16 13:32 [PATCH] HID: logitech-hidpp: Replace devm_kasprintf() call by devm_kstrdup() in hidpp_connect_event() Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®