mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-input@vger.kernel.org, "Bastien Nocera" <hadess@hadess.net>,
	"Benjamin Tissoires" <bentiss@kernel.org>,
	"Filipe Laíns" <lains@riseup.net>,
	"Jiri Kosina" <jikos@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Chenyuan Yang <chenyuan0y@gmail.com>,
	Julia Lawall <julia.lawall@inria.fr>
Subject: [PATCH] HID: logitech-hidpp: Replace devm_kasprintf() call by devm_kstrdup() in hidpp_connect_event()
Date: Wed, 16 Apr 2025 15:32:07 +0200	[thread overview]
Message-ID: <99e0a0e0-1b21-4e94-a9ff-2dc5715d676d@web.de> (raw)

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


                 reply	other threads:[~2025-04-16 13:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99e0a0e0-1b21-4e94-a9ff-2dc5715d676d@web.de \
    --to=markus.elfring@web.de \
    --cc=bentiss@kernel.org \
    --cc=chenyuan0y@gmail.com \
    --cc=hadess@hadess.net \
    --cc=jikos@kernel.org \
    --cc=julia.lawall@inria.fr \
    --cc=lains@riseup.net \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®