mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-perf-users@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Suzuki Poulouse <suzuki.poulose@arm.com>,
	Will Deacon <will@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Chenyuan Yang <chenyuan0y@gmail.com>,
	Julia Lawall <julia.lawall@inria.fr>
Subject: [PATCH] perf/thunderx2: Replace devm_kasprintf() call by devm_kstrdup() in tx2_uncore_pmu_register()
Date: Wed, 16 Apr 2025 17:28:44 +0200	[thread overview]
Message-ID: <d4516add-45ad-412a-b9bf-ee21afae3da9@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 16 Apr 2025 17:15:54 +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/perf/thunderx2_pmu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c
index 6ed4707bd6bb..f0d7d1f9948a 100644
--- a/drivers/perf/thunderx2_pmu.c
+++ b/drivers/perf/thunderx2_pmu.c
@@ -736,9 +736,7 @@ static int tx2_uncore_pmu_register(
 		.capabilities	= PERF_PMU_CAP_NO_EXCLUDE,
 	};
 
-	tx2_pmu->pmu.name = devm_kasprintf(dev, GFP_KERNEL,
-			"%s", name);
-
+	tx2_pmu->pmu.name = devm_kstrdup(dev, name, GFP_KERNEL);
 	return perf_pmu_register(&tx2_pmu->pmu, tx2_pmu->pmu.name, -1);
 }
 
-- 
2.49.0


                 reply	other threads:[~2025-04-16 15:28 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=d4516add-45ad-412a-b9bf-ee21afae3da9@web.de \
    --to=markus.elfring@web.de \
    --cc=chenyuan0y@gmail.com \
    --cc=ganapatrao.kulkarni@cavium.com \
    --cc=julia.lawall@inria.fr \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@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®